結果

問題 No.982 Add
ユーザー tubuann1tubuann1
提出日時 2020-01-22 13:57:05
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 1,307 ms
使用メモリ 3,572 KB
最終ジャッジ日時 2022-11-24 15:10:10
合計ジャッジ時間 3,306 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,460 KB
testcase_01 AC 1 ms
3,540 KB
testcase_02 AC 2 ms
3,508 KB
testcase_03 AC 1 ms
3,452 KB
testcase_04 AC 2 ms
3,456 KB
testcase_05 AC 1 ms
3,388 KB
testcase_06 AC 2 ms
3,492 KB
testcase_07 AC 1 ms
3,452 KB
testcase_08 AC 1 ms
3,452 KB
testcase_09 AC 1 ms
3,564 KB
testcase_10 AC 1 ms
3,492 KB
testcase_11 AC 2 ms
3,456 KB
testcase_12 AC 1 ms
3,536 KB
testcase_13 AC 1 ms
3,528 KB
testcase_14 AC 1 ms
3,548 KB
testcase_15 AC 2 ms
3,496 KB
testcase_16 AC 2 ms
3,492 KB
testcase_17 AC 1 ms
3,540 KB
testcase_18 AC 1 ms
3,540 KB
testcase_19 AC 1 ms
3,488 KB
testcase_20 AC 1 ms
3,564 KB
testcase_21 AC 2 ms
3,572 KB
testcase_22 AC 1 ms
3,392 KB
testcase_23 AC 2 ms
3,452 KB
testcase_24 AC 2 ms
3,496 KB
testcase_25 AC 1 ms
3,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

ll gcd(ll a,ll b){
  while(b!=0){a%=b; swap(a,b);}
  return a;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B;
  cin>>A>>B;
  cout<<(gcd(A,B)==1?(A-1)*(B-1)/2:-1)<<endl;

  return 0;
}
0