結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー nebukuro09
提出日時 2017-06-14 09:55:10
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 1,134 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 116,372 KB
実行使用メモリ 7,484 KB
最終ジャッジ日時 2024-06-12 20:02:43
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!uint.gcdImpl`

ソースコード

diff #
プレゼンテーションモードにする

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
void main() {
auto s = readln.split.map!(to!int);
auto P = s[0];
auto Q = s[1];
auto N = readln.chomp.to!int;
if (P > Q) swap(P, Q);
if (P == 0 && Q == 0) {
int ans = 0;
while (N--) {
s = readln.split.map!(to!int);
if (s[0] == 0 && s[1] == 0) ans++;
}
ans.writeln;
return;
} else if (P == 0) {
int ans = 0;
while (N--) {
s = readln.split.map!(to!int);
if (s[0] % Q == 0 && s[1] % Q == 0) ans ++;
}
ans.writeln;
return;
}
auto G = gcd(P, Q);
P /= G;
Q /= G;
int ans = 0;
while (N--) {
s = readln.split.map!(to!int);
auto x = s[0];
auto y = s[1];
if (x % G > 0 || y % G > 0) continue;
x /= G;
y /= G;
if (P % 2 == 0 || Q % 2 == 0 || (x + y) % 2 == 0) ans += 1;
}
ans.writeln;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0