結果
| 問題 |
No.49 算数の宿題
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2014-10-23 22:51:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 312 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 01:41:36 |
| 合計ジャッジ時間 | 880 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:27: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | char s[1000];scanf("%s",s);
| ~~~~~^~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
using namespace std;
//namaega 184
int main(){
char s[1000];scanf("%s",s);
int ans=atoi(s);
for(char *p=s;*p!='\0';p++){
if(*p=='*')ans*=atoi(p+1);
else if(*p=='+')ans+=atoi(p+1);
}
printf("%d\n",ans);
return 0;
}
184