結果

問題 No.49 算数の宿題
ユーザー 184
提出日時 2014-10-23 22:51:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 01:41:40
合計ジャッジ時間 731 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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);
      |                      ~~~~~^~~~~~~~

ソースコード

diff #

#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);
	printf("%d\n",ans);
	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;
}
0