結果

問題 No.1027 U+1F4A0
ユーザー noriocnorioc
提出日時 2020-04-17 22:05:59
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 1,801 ms
コンパイル使用メモリ 174,272 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 06:40:10
合計ジャッジ時間 2,836 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

int calc(int d1, int d2) {
    if (d1 == d2) return 4;
    if (d1 > d2) return 0;

    double r = sqrt(1.0 * d1);
    double s = sqrt(d2 / 2.0);
    if (r < s) return 0;
    if (r > s) return 8;
    return 4;
}

void main() {
    int d1, d2; scan(d1, d2);
    writeln(calc(d1, d2));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
0