結果

問題 No.222 引き算と足し算
ユーザー naimonon77
提出日時 2015-11-24 15:57:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 454 bytes
コンパイル時間 943 ms
コンパイル使用メモリ 59,076 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-15 22:07:17
合計ジャッジ時間 1,447 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |   scanf("%d%c%d",&x,&op,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */


int main(void)
{
  int i,j;
  int x,y;
  char op;
  int rep;
  scanf("%d%c%d",&x,&op,&y);
  if(op == '+') rep = x - y;
  else rep = x + y;
  printf("%d\n",rep);
  return 0;
}
0