Codeforces Gym101502 A.Very Hard Question

2017 JUST Programming Contest 3.0

昨天的训练赛,打的好难过,因为被暴打了,写了8题,他们有的写了9题,差了一道dp,博客上写7道题的题解。

因为有一道是套板子过的,并不懂,他们说是取数博弈,也有学长说是记忆化dp,等学会了再写博客。。。

先占个坑,D题dp,J题记忆化dp(取数博弈)。。。

写其他的题解,这场比赛感触很深,测评姬一开始睡觉了,emnnn,然后发生了很多有趣的故事。。。

卡数组大小,卡输入输出,长个脑子了,不要轻易用cout,用的话关流同步ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);(都是后话了。。。)

回归正题,写题解。。。

A. A Very Hard Question
 
time limit per test
1.0 s
memory limit per test
256 MB
input
standard input
output
standard output

Husam was preparing himself for the Graduate Record Examinations (GRE). Yesterday, he read a very hard question, but he could not find a solution for it, so he did not sleep all the night.

Husam decided to tell you about the question, so you can help him to find the solution. The question is: If the price of the orange was increased by x%. How many oranges can be bought for the amount that used to buy yoranges?

Can you help Husam to solve this question?

Input

The first line contains an integer T (1  ≤  T  ≤  104), where T is the number of test cases.

Then T lines follow, each line contains two integers y and x (1  ≤  y  ≤  106) (0  ≤  x  ≤  100), where y is the number of oranges, and x is the percentage increase in price.

Output

For each test case, print a single line containing the number of oranges that can be bought for the same amount of money that used to buy y oranges before the price increased.

It is guaranteed that all answers are integer numbers. Do not print any floating-point values.

Example
input
3
10 25
300 20
550 100
output
8
250
275

这个水题卡cout,很不幸被卡了一手。。。

代码:

 1 //A. Very Hard Question-卡一手cout
 2 #include<iostream>
 3 #include<cstring>
 4 #include<cstdio>
 5 #include<algorithm>
 6 using namespace std;
 7 int main(){
 8     int t;
 9     scanf("%d",&t);
10     while(t--){
11         int n,m,ans;
12         scanf("%d%d",&n,&m);
13         ans=n*100*1.0/(100+m);
14         printf("%d
",ans);
15     }
16     return 0;
17 }
原文地址:https://www.cnblogs.com/ZERO-/p/8353322.html