結果

問題 No.149 碁石の移動
ユーザー Bantako
提出日時 2017-07-22 13:05:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 157,964 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 03:26:45
合計ジャッジ時間 2,057 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d%d%d%d%d%d",&Aw,&Ab,&Bw,&Bb,&C,&D);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
main(){
    int Aw,Ab,Bw,Bb,C,D;
    scanf("%d%d%d%d%d%d",&Aw,&Ab,&Bw,&Bb,&C,&D);
    Aw -= max(0,C-Ab);
    Bw += max(0,C-Ab);
    Bb += min(Ab,C);
    Ab -= min(Ab,C);
    //
    Aw += min(Bw,D);
    printf("%d\n",Aw);
}
0