結果

問題 No.35 タイパー高橋
ユーザー hape8810
提出日時 2019-01-31 13:12:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 04:33:52
合計ジャッジ時間 997 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d %s",&T,S);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main(void){
    int N,a,T,len;
    char S[101];
    int K=0,A=0;//K=成功 A=余り
    scanf("%d",&N);
    for(int x=0;x<N;x++){
        scanf("%d %s",&T,S);
        a=(12*T)/1000;
        len=strlen(S);
        if(a>=len){
            K+=len;
        }
        else{
            K+=a;
            A=A+(len-a);
        }
    }
    printf("%d %d\n",K,A);
    
    return 0;
}
0