結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-06 13:38:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 626 bytes |
| コンパイル時間 | 1,567 ms |
| コンパイル使用メモリ | 167,484 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 17:12:05 |
| 合計ジャッジ時間 | 2,285 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
bool judge(int a, int b, int c){
if(a<b&&b>c&&a<c) return true;
else if(a<b&&b>c&&a>c) return true;
else if(a>b&&b<c&&a<c) return true;
else if(a>b&&b<c&&a>c) return true;
else return false;
}
int main(){
int a1,a2,a3; cin>>a1>>a2>>a3;
if(judge(a1,a2,a3)){cout<<"INF"<<endl; return 0;}
if(!(a1!=a2&&a1!=a3&&a2!=a3)){cout<<0<<endl; return 0;}
int ans=0; int mx=max(a1,max(a2,a3));
for(int i=3; i<=mx; i++){
int b1=a1%i; int b2=a2%i; int b3=a3%i;
if(judge(b1,b2,b3)) ans++;
}
cout<<ans<<endl;
}