結果

問題 No.816 Beautiful tuples
ユーザー totori_nyaa
提出日時 2019-04-19 21:27:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 295 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 166,100 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 16:29:43
合計ジャッジ時間 2,209 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
 
int main(){
    long long a,b;
    cin>>a>>b;
    long long ans=0;
    if(a==1 || b==1){
        cout<<-1<<endl;
        return 0;
    }
    if((a+b)%(a-1)==0){
        ans=(a+b)/(a-1);
        cout<<ans<<endl;
    }
    else cout<<-1<<endl;
    
}
0