結果
問題 | No.358 も~っと!門松列 |
ユーザー |
|
提出日時 | 2018-09-05 22:54:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 612 ms |
コンパイル使用メモリ | 64,128 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 17:23:32 |
合計ジャッジ時間 | 1,403 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <iostream> using namespace std; bool IsMenShong(int B1,int B2,int B3) { if (B1==B2 || B1==B3 || B2==B3){ return false; } if (B2==min(B1,min(B2,B3))){ return true; } if (B2==max(B1,max(B2,B3))){ return true; } return false; } int main(int argc, char* argv[]) { int A1,A2,A3; cin>>A1>>A2>>A3; int maxA=max(A1,max(A2,A3))+1; int B1=A1%maxA; int B2=A2%maxA; int B3=A3%maxA; if (IsMenShong(B1,B2,B3)){ cout<<"INF"<<endl; return 0; } int ans=0; int p; for (p=1;p<=maxA;p++){ B1=A1%p; B2=A2%p; B3=A3%p; if (IsMenShong(B1,B2,B3)){ ans++; } } cout<<ans<<endl; return 0; }