結果

問題 No.358 も~っと!門松列
ユーザー kpinkcatkpinkcat
提出日時 2023-08-14 00:25:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 880 bytes
コンパイル時間 1,231 ms
コンパイル使用メモリ 106,720 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 13:51:46
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,944 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,944 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
testcase_14 WA -
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 WA -
testcase_21 AC 2 ms
6,940 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    int a1, a2, a3, cnt = 0;
    cin >> a1 >> a2 >> a3;
    if (a1 == a2 || a1 == a3 || a2 == a3){
        cout << 0 << endl;
        return 0;
    } else if (a2 == max({a1, a2, a3}) || a2 == min({a1, a2, a3})){
        cout << "INF" << endl;
        return 0;
    } else {
        for (int i = 2; i <= max({a1, a2, a3}); i++){
            int s = a1%i, t = a2%i, u = a3%i;
            if ((s != t) && (s != u) && (t != u)){
                if ((t == max({s, t, u})) || (t == min({s, t, u}))){
                    cnt++;
                    cout << i << endl;
                }
            }
        }
    }
    cout << cnt << endl;
}
0