結果
問題 |
No.1352 Three Coins
|
ユーザー |
|
提出日時 | 2021-01-17 13:24:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 1,854 ms |
コンパイル使用メモリ | 165,712 KB |
実行使用メモリ | 7,384 KB |
最終ジャッジ日時 | 2024-11-29 20:05:48 |
合計ジャッジ時間 | 2,587 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 12 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; int gcd(int a,int b){return b?gcd(b,a%b):a;} bool ok[4010000]; signed main(){ int A,B,C;cin>>A>>B>>C; if(gcd(gcd(A,B),C)!=1){ puts("-1"); return 0; } int ans=0; ok[0]=1; for(int i=0;i<A*B;i++){ ans+=!ok[i]; ok[i+A]|=ok[i]; ok[i+B]|=ok[i]; ok[i+C]|=ok[i]; } cout<<ans<<endl; }