結果
問題 | No.49 算数の宿題 |
ユーザー |
![]() |
提出日時 | 2014-10-23 22:53:05 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 29,568 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 01:41:39 |
合計ジャッジ時間 | 768 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 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 184int 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;}