結果
問題 | No.49 算数の宿題 |
ユーザー |
![]() |
提出日時 | 2018-11-14 17:34:48 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 346 ms |
コンパイル使用メモリ | 29,184 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 02:00:39 |
合計ジャッジ時間 | 760 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <ctype.h> int main() { long long n=0,m=0; int i=0,ope=0; char s[101]; scanf("%s",s); while (1) { for (m=0;isdigit(s[i]);i++) m=m*10+(s[i]-'0'); switch (ope) { case 1:// 足し算 n+=m; break; case 2:// 掛け算 n*=m; break; default: n=m; break; } switch (s[i++]) { case '*':// 足し算 ope=1; break; case '+':// 掛け算 ope=2; break; default: printf("%lld",n); return 0; } } return 0; }