結果
問題 | No.358 も~っと!門松列 |
ユーザー |
![]() |
提出日時 | 2018-10-20 23:06:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 56,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 03:01:09 |
合計ジャッジ時間 | 1,866 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<iostream> #include <algorithm> using namespace std; int max(int s,int t,int z){ if(z>s && z>t) return z; if(s>z && s>t) return s; if(t>s && t>z) return t; return 0; } int main(){ int a,b,c; int co=0; cin>>a>>b>>c; if(b>a && b>c){ if(a!=c){ cout<<"INF"<<endl;; return 0; } if(a==c){ cout<<"0"<<endl; return 0; } } if(b<a && b<c){ if(a!=c){ cout<<"INF"<<endl; return 0; } if(a==c){ cout<<"0"<<endl; return 0; } } int s=max(a,b,c); for(int i=1;i<=s;i++){ int x=a%i; int y=b%i; int z=c%i; if(x>y && z>y){ if(x!=z) co++; } if(y>z && y>x){ if(x!=z) co++; } } cout<<co<<endl; return 0; }