結果
問題 | No.49 算数の宿題 |
ユーザー |
![]() |
提出日時 | 2015-02-04 06:16:48 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 410 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 24,064 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 01:43:36 |
合計ジャッジ時間 | 792 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <cstdio>#include <cstdlib>#include <cstring>int main(){char s[128], t[128];while (~scanf("%s", s)) {strcpy(t, s);char* p=strtok(s, "+*");int res=atoi(p);while (p=strtok(0, "+*")) {int x=atoi(p);if (t[p-s-1]=='+')res*=x;elseres+=x;}printf("%d\n", res);}}