結果
| 問題 |
No.982 Add
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-11 13:34:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 746 bytes |
| コンパイル時間 | 1,535 ms |
| コンパイル使用メモリ | 169,956 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 07:20:53 |
| 合計ジャッジ時間 | 2,208 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 9 WA * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;
template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
int main() {
int a, b; scanf("%d%d", &a, &b);
if(std::__gcd(a, b) != 1) printf("-1\n");
else {
std::vector<bool> cnt(a * 1000 + b * 1000 + 1, false);
for(int x = 0; x <= 1000; x++) {
for(int y = 0; y <= 1000; y++) {
cnt[a * x + b * y] = true;
}
}
int ans = 0;
for(auto v: cnt) ans += !v;
printf("%d\n", ans);
}
return 0;
}