結果
| 問題 |
No.35 タイパー高橋
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-14 16:49:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 791 bytes |
| コンパイル時間 | 369 ms |
| コンパイル使用メモリ | 31,744 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 21:56:49 |
| 合計ジャッジ時間 | 816 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d",&T);
| ~~~~~^~~~~~~~~
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%s",S);
| ~~~~~^~~~~~~~
main.cpp:33:20: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
33 | cCount += length;
| ~~~~~~~^~~~~~~~~
ソースコード
#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;
}