結果

問題 No.35 タイパー高橋
ユーザー SyuutaroSyuutaro
提出日時 2018-03-14 16:49:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 33,492 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 15:39:44
合計ジャッジ時間 834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:20: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             cCount += length;
             ~~~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>
int main(){
    //iuput
    int N;
    scanf("%d",&N);

    int cCount = 0;
    int fCount = 0;
    for (int i = 0;i < N;i++){
        int T;
        char S[100+1];
        scanf("%d",&T);
        scanf("%s",S);

        //typing limit
        int limit = floor(12*T/1000.0);

        //S length
        int length;
        for (int j = 0;j < 101;j++){
            if (S[j] == '\0'){
                length = j;
                break;
            }
        }

        //compare limit with length and count
        if (limit <= length){
            cCount += limit;
            fCount += length-limit;
        }else{
            cCount += length;
            fCount += 0;
        }
    }

    //output
    printf("%d %d\n",cCount,fCount);
    return 0;
}
0