結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-09 07:00:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 70,608 KB |
| 最終ジャッジ日時 | 2025-01-09 15:18:05 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include <iostream>
#include <algorithm>
bool judge(int a, int b, int c) {
if (a == b || b == c || c == a) return false;
if (a < b && b < c) return false;
if (a > b && b > c) return false;
return true;
}
void solve() {
int a, b, c;
std::cin >> a >> b >> c;
if (judge(a, b, c)) {
std::cout << "INF" << std::endl;
return;
}
int ans = 0;
for (int p = 1; p <= std::max({a, b, c}); ++p) {
if (judge(a % p, b % p, c % p)) ++ans;
}
std::cout << ans << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}