結果

問題 No.586 ダブルブッキング
ユーザー じゃがりこじゃがりこ
提出日時 2018-08-10 20:59:16
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 280 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 23,156 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 13:33:18
合計ジャッジ時間 1,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
    9 |         scanf("%d",R);
      |                ~^  ~
      |                 |  |
      |                 |  int
      |                 int*
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d%d",&P1,&P2);
      |     ~~~~~^~~~~~~~~~~~~~~~
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",R);
      |         ~~~~~^~~~~~~~
main.cpp:9:14: warning: ‘R’ may be used uninitialized [-Wmaybe-uninitialized]
    9 |         scanf("%d",R);
      |         ~~~~~^~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
    int P1,P2,N,R,M=0,c=0,i;
    
    scanf("%d%d",&P1,&P2);
    scanf("%d",&N);
    for(i = 0; i < N; i++){
        scanf("%d",R);
        if(R == M){
            c++;
        }else{
            M = R;
        }
    }
    printf("%d",c*(P1+P2));
}
0