結果

問題 No.1509 Swap!!
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-16 23:36:07
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 870 bytes
コンパイル時間 8,846 ms
コンパイル使用メモリ 165,848 KB
実行使用メモリ 210,352 KB
最終ジャッジ日時 2024-06-16 23:36:25
合計ジャッジ時間 16,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
30,336 KB
testcase_01 AC 60 ms
30,336 KB
testcase_02 AC 179 ms
55,680 KB
testcase_03 AC 184 ms
55,296 KB
testcase_04 AC 177 ms
55,424 KB
testcase_05 AC 174 ms
55,164 KB
testcase_06 AC 174 ms
55,504 KB
testcase_07 AC 172 ms
55,528 KB
testcase_08 AC 173 ms
55,392 KB
testcase_09 AC 175 ms
55,296 KB
testcase_10 AC 174 ms
55,552 KB
testcase_11 AC 254 ms
55,904 KB
testcase_12 AC 237 ms
55,904 KB
testcase_13 AC 236 ms
56,056 KB
testcase_14 AC 236 ms
55,804 KB
testcase_15 AC 263 ms
55,936 KB
testcase_16 AC 235 ms
56,040 KB
testcase_17 AC 236 ms
55,548 KB
testcase_18 AC 235 ms
55,788 KB
testcase_19 AC 236 ms
55,548 KB
testcase_20 AC 268 ms
55,808 KB
testcase_21 AC 174 ms
55,164 KB
testcase_22 AC 176 ms
55,400 KB
testcase_23 AC 178 ms
55,264 KB
testcase_24 AC 176 ms
55,412 KB
testcase_25 AC 177 ms
55,424 KB
testcase_26 AC 202 ms
55,552 KB
testcase_27 AC 127 ms
51,968 KB
testcase_28 AC 128 ms
52,224 KB
testcase_29 AC 127 ms
52,176 KB
testcase_30 AC 237 ms
210,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new bool[t];
        for (var u = 0; u < t; ++u)
        {
            var c = NList;
            ans[u] = Swap(c[0], c[1], c[2]);
        }
        WriteLine(string.Join("\n", ans.Select(f => f ? "YES" : "NO")));
    }
    static bool Swap(long n, long a, long b)
    {
        return GCD(a, b) == 1 && a + b <= n + 1;
    }
    static long GCD(long a, long b)
    {
        if (a < b) return GCD(b, a);
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }
}
0