結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー heaveneleven521
提出日時 2021-03-31 15:00:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 165,264 KB
実行使用メモリ 13,648 KB
最終ジャッジ日時 2024-12-14 22:36:58
合計ジャッジ時間 20,992 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 27 TLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 long long a,b,n,m;
 cin >> a >> b >> n >> m;
 if(a>b){
     int p = (a-b)/n;
     while(a>b){
         a-=p;
         b+=p;
     }
     cout << a << endl;
 }
 else{
     int q = (b-a)/m;
     while(b>=a){
         a+=q;
         b-=q;
     }
 }
 }
0