QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741789 | #9628. 骰子 | TauLee01# | AC ✓ | 0ms | 3608kb | C++17 | 547b | 2024-11-13 15:13:45 | 2024-11-13 15:13:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
int n,m,ans;
int a[4]={6,2,1,5},b[4]={6,3,1,4};
void solve(){
cin>>n>>m;
ans=0;
if(n>=2&&m>=2){
ans=n*m*6;
cout<<ans<<endl;
return;
}
if(m==1){
for(int i=0;i<n;++i){
ans+=a[i%4];
}
}
else{
for(int i=0;i<m;++i){
ans+=b[i%4];
}
}
cout<<ans<<endl;
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int _ = 1;
// cin >> _;
while (_--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
2 2
output:
24
result:
ok single line: '24'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1000 1000
output:
6000000
result:
ok single line: '6000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
987 654
output:
3872988
result:
ok single line: '3872988'