結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
soupesuteaka
|
| 提出日時 | 2017-05-01 11:52:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,117 bytes |
| コンパイル時間 | 669 ms |
| コンパイル使用メモリ | 64,436 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 01:49:52 |
| 合計ジャッジ時間 | 1,549 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
// macros
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define LLINF 1000000000000000000LL
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define debug(a) cout << "L(" << __LINE__ << "):" << #a << ":" << a << endl;
// problems limits
#define MAX_N 100
// Variables
int A[3];
// problems input
void input()
{
FOR(i,0,3) cin >> A[i];
}
// problems main
bool isKadomatsu(int a1, int a2, int a3)
{
bool res=false;
res |= (a2 > a1 && a2 > a3);
res |= (a2 < a1 && a2 < a3);
res &= (a1 != a2 && a2 != a3 && a3 != a1);
return res;
}
void solve()
{
if (isKadomatsu(A[0],A[1],A[2])) {
cout << "INF" << endl;
return;
}
int m = max(A[0],max(A[1],A[2]));
int ans=0;
FOR(p,2,m+1) {
if (isKadomatsu(A[0]%p, A[1]%p, A[2]%p)) {
ans++;
}
}
cout << ans << endl;
}
int main()
{
ios::sync_with_stdio(false);
input();
solve();
}
soupesuteaka