QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#738117#9628. 骰子Aicu123AC ✓0ms3612kbC++201.1kb2024-11-12 17:47:042024-11-12 17:47:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 17:47:12]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3612kb
  • [2024-11-12 17:47:04]
  • 提交

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'