結果

問題 No.35 タイパー高橋
ユーザー LayCurse
提出日時 2014-09-26 14:40:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 2,698 ms
コンパイル使用メモリ 157,024 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 06:29:39
合計ジャッジ時間 2,407 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   scanf("%d",&N);
      |   ~~~~~^~~~~~~~~
main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%d%s",T+i,S[i]);
      |     ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int N;
int T[1111];
char S[1111][111]; int len[1111];

int main(){
  int i, j, k;
  int res1 = 0, res2 = 0;

  scanf("%d",&N);
  assert(1 <= N && N <= 1000);
  rep(i,N){
    scanf("%d%s",T+i,S[i]);
    len[i] = strlen(S[i]);

    assert(1 <= T[i] && T[i] <= 30000);
    assert(1 <= len[i] && len[i] <= 100);
    rep(k,len[i]) assert('a'<=S[i][k] && S[i][k] <= 'z');
  }

  rep(i,N){
    k = min(len[i], T[i] * 12 / 1000);
    res1 += k;
    res2 += len[i] - k;
  }

  printf("%d %d\n", res1, res2);

  return 0;
}
0