結果
問題 |
No.358 も~っと!門松列
|
ユーザー |
![]() |
提出日時 | 2020-05-04 11:42:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 1,957 ms |
コンパイル使用メモリ | 167,512 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 00:22:53 |
合計ジャッジ時間 | 2,341 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C; cin >> A >> B >> C; auto f = []( int a, int b, int c ) -> bool { if( a == b || b== c || c == a ) return false; if( a < b && b > c || a > b && b < c ) return true; return false; }; if( f( A, B, C ) ) { cout << "INF" << endl; } else { int ans = 0; int ma = max( A, max( B, C ) ); for( int p = 1; p <= ma; p++ ) { if( f( A % p, B % p, C % p ) ) ans++; } cout << ans << endl; } }