結果
問題 |
No.358 も~っと!門松列
|
ユーザー |
|
提出日時 | 2018-12-31 16:55:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 1,635 ms |
コンパイル使用メモリ | 167,852 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 17:10:20 |
合計ジャッジ時間 | 2,722 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int a, b, c; bool ok(int mod) { int x = a % mod; int y = b % mod; int z = c % mod; if(x == y || y == z || z == x) { return false; } if(min({x, y, z}) == y || max({x, y, z}) == y) { return true; } else { return false; } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> a >> b >> c; if(a == b || b == c || c == a) { cout << 0 << endl; return 0; } if(min({a, b, c}) == b || max({a, b, c}) == b) { cout << "INF" << endl; return 0; } int ans = 0; for(int i = 1; i <= 1000; i++) { if(ok(i)) ans++; } cout << ans << endl; return 0; }