結果

問題 No.35 タイパー高橋
コンテスト
ユーザー Syuutaro
提出日時 2018-03-14 16:49:25
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 791 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 447 ms
コンパイル使用メモリ 51,492 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-22 02:33:56
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:29:9: warning: 'length' may be used uninitialized [-Wmaybe-uninitialized]
   29 |         if (limit <= length){
      |         ^~
main.cpp:20:13: note: 'length' was declared here
   20 |         int length;
      |             ^~~~~~

ソースコード

diff #
raw source code

#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