結果
| 問題 | No.982 Add |
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2020-02-11 16:09:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 1,563 ms |
| コンパイル使用メモリ | 172,788 KB |
| 実行使用メモリ | 9,552 KB |
| 最終ジャッジ日時 | 2024-10-01 08:01:18 |
| 合計ジャッジ時間 | 3,413 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T>
void fin(T a){
cout<<a<<endl;
exit(0);
}
signed main(){
int a,b;cin>>a>>b;
if(__gcd(a,b)>1)fin(-1);
vector<int> v;
for(int i=0;i<1000;i++)for(int j=0;j<1000;j++)v.push_back(a*i+b*j);
sort(v.begin(),v.end());
unique(v.begin(),v.end());
int ans=0;
for(int i=0;i<1000;i++)ans+=v[i+1]-v[i]-1;
fin(ans);
}
cureskol