結果
| 問題 | No.321 (P,Q)-サンタと街の子供たち |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-01 22:38:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 1,245 ms |
| コンパイル使用メモリ | 210,104 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-26 13:12:51 |
| 合計ジャッジ時間 | 4,319 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int p,q,d,f,n,x,y,s=0;
scanf("%d%d%d",&p,&q,&n);
if(p==0&&q==0){
while(n--){
scanf("%d%d",&x,&y);
if(x==0&&y==0)s++;
}
}else{
d=gcd(p,q);
if(p/d%2==0||q/d%2==0)f=1;
else f=0;
while(n--){
scanf("%d%d",&x,&y);
if(x%d==0&&y%d==0&&(f||(x/d+y/d)%2==0))s++;
}
}
printf("%d\n",s);
return 0;
}