結果

問題 No.2517 Right Triangles on Circle
ユーザー InTheBloomInTheBloom
提出日時 2023-10-27 22:06:14
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 3,665 ms
コンパイル使用メモリ 174,716 KB
実行使用メモリ 29,952 KB
最終ジャッジ日時 2024-09-25 14:11:29
合計ジャッジ時間 5,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main () {
    int N, M; readln.read(N, M);
    int[] A = readln.split.to!(int[]);

    solve(N, M, A);
}

void solve (int N, int M, int[] A) {
    /* 円周角の定理 */
    long ans = 0;
    bool[long] mp;
    foreach (a; A) mp[2*a] = true;

    foreach (a; A) if ((1L*2*a+M) in mp) ans += N-2;

    writeln(ans);
}

void read(T...)(string S, ref T args) {
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0