QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#738117 | #9628. 骰子 | Aicu123 | AC ✓ | 0ms | 3612kb | C++20 | 1.1kb | 2024-11-12 17:47:04 | 2024-11-12 17:47:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define fi first
#define se second
//cout<<setiosflags(ios::fixed)<<setprecision(K);
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};
const double eps=1e-9;
const double PI=acos(-1.0);
const int inf=1e9+7;
const int mod=998244353;
const int N=2e5+10,M=N<<1;
void solve(){
int n,m;
cin>>n>>m;
if(n!=1&&m!=1){
cout<<6*n*m<<'\n';
} else if(n==1){
int s=6+3+1+4;
int ans=0;
int d=m/4;
ans+=s*d;
m%=4;
vector<int>a(4);
a[1]=6,a[2]=3,a[3]=1;
for(int i=1;i<=m;i++) ans+=a[i];
cout<<ans<<'\n';
} else {
int s=6+2+1+5;
int ans=0;
int d=n/4;
ans+=s*d;
n%=4;
vector<int>a(4);
a[1]=6,a[2]=2,a[3]=1;
for(int i=1;i<=n;i++) ans+=a[i];
cout<<ans<<'\n';
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int T=1;
//cin>>T;
while(T--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
2 2
output:
24
result:
ok single line: '24'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1000 1000
output:
6000000
result:
ok single line: '6000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
987 654
output:
3872988
result:
ok single line: '3872988'