結果
| 問題 |
No.1200 お菓子配り-3
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-08-28 22:11:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 886 bytes |
| コンパイル時間 | 1,796 ms |
| コンパイル使用メモリ | 166,956 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 15:21:51 |
| 合計ジャッジ時間 | 6,883 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 WA * 2 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
int main() {
int tsz;
cin >> tsz;
rep(_, tsz) {
int x, y;
cin >> x >> y;
if (x < y) swap(x, y);
int p = x + y, q = x - y;
int d = 1;
int ans = 0;
while(d * d <= q) {
if (q % d == 0) {
int d2 = q / d;
rep(_, d == d2 ? 1 : 2) {
int s = d + 2, bc = p / s;
ans += p % s == 0 && (bc & 1) == (d2 & 1) && bc > d2;
swap(d, d2);
}
}
d += 1;
}
cout << ans << endl;
}
}
Kude