結果
問題 |
No.176 2種類の切手
|
ユーザー |
![]() |
提出日時 | 2015-04-25 20:54:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 399 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 41,212 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 03:19:22 |
合計ジャッジ時間 | 1,304 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 5 WA * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int a,b,c;scanf("%d%d%d",&a,&b,&c); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <algorithm> #include <map> using namespace std; int main(){ int a,b,c;scanf("%d%d%d",&a,&b,&c); long long cm=(long long)a*b;if(a>b)swap(a,b); int ans=2*1000000000; int n=a,m=b; int x=0;while(x=m%n){m=n;n=x;};//cm/=n; a/=n;b/=n; c=(c+n-1)/n*n; for(int i=0;i<=a;i++){ if(c%a==0||c%b==0){ans=c;break;} } printf("%d\n",ans); return 0; }