結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-09-26 22:37:37 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 648 bytes | 
| コンパイル時間 | 1,792 ms | 
| コンパイル使用メモリ | 195,900 KB | 
| 最終ジャッジ日時 | 2025-02-07 16:29:40 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    auto f = [&](int x[]) {
        auto [mi, ma] = minmax({x[0], x[1], x[2]});
        return x[0] != x[1] && x[1] != x[2] && x[2] != x[0] && (x[1] == mi || x[1] == ma);
    };
    int A[3]; rep(i,3) cin >> A[i];
    if(f(A)) {
        cout << "INF" << endl;
    } else {
        int ans = 0;
        for(int p = 1; p <= 1000; p++) {
            int B[3];
            rep(i,3) B[i] = A[i] % p;
            if(f(B)) ans++;
        }
        cout << ans << endl;
    }
}