AtCoder Beginner Contest 050 ABC题

发布时间:2017-2-24 7:07:04 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"AtCoder Beginner Contest 050 ABC题 ",主要涉及到AtCoder Beginner Contest 050 ABC题 方面的内容,对于AtCoder Beginner Contest 050 ABC题 感兴趣的同学可以参考一下。

A - Addition and Subtraction Easy


Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either + or -. Your task is to evaluate the formula instead of her.

Constraints

  • 1≦A,B≦109
  • op is either + or -.

Input

The input is given from Standard Input in the following format:

A op B

Output

Evaluate the formula and print the result.


Sample Input 1

Copy
1 + 2

Sample Output 1

Copy
3

Since 1+2=3, the output should be 3.


Sample Input 2

Copy
5 - 7

Sample Output 2

Copy
-2

 解法:没什么好说的

#include<bits/stdc++.h>using namespace std;map<int,int>q;long long h,m;char s;int main(){    scanf("%lld %c %lld",&h,&s,&m);    if(s=='+')    {        printf("%lld\n",h+m);    }    else    {         printf("%lld\n",h-m);    }    return 0;}

B - Contest with Drinks Easy


Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered1 through N. Joisino knows that it takes her Ti seconds to solve problem i(1≦iN).

Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes drink i(1≦iM), her brain will be stimulated and the time it takes for her to solve problem Pi will become Xi seconds. It does not affect the time to solve the other problems.

A contestant is allowed to take exactly one of the drinks before the start of the contest. For each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink. Here, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems. Your task is to write a program to calculate it instead of her.

Constraints

  • All input values are integers.
  • 1≦N≦100
  • 1≦Ti≦105
  • 1≦M≦100
  • 1≦PiN

上一篇:Visual Studio 2017RC 版本相关资料
下一篇:安卓手机优化 ROOT自启动管理 + 电量管理

相关文章

相关评论