题目:
Even though he is the head of the Shitalian Mafia, Shi doesn't like bloodshed and punishes his subordinates if they kill innocent people. That is why the death report is always written in the following way: "We killed x% of the innocent people".
Shi wants to know the smallest number of innocent people that must have been in that place so that exactlyx% of the innocent people have died.
For instance, if we have x = 35%. In this case we had 20 people, and 7 were victims, because 35% of 20 is 7. That is the minimum possible.
Input
There is a single number 0 ≤ x ≤ 100 with at most 15 decimal places.
Output
Print the number sought by Shi.
Sample Input
Input
35
Output
20
Input
50.0
Output
2
Input
7.500
Output
40
Input
35.123456789
Output
100000000000 题意: 给你一个百分数,让你求一个最小数,使得这个最小的整数乘以这个百分数后可以得到一个整数 分析: 把给定的数存为字符串,使得可以计算出移动小数点多少位后(k),可以使的给的实数变为整数,然后分子分母通扩大k倍,然后乱搞。。。。
1 #include2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 char num[20]; 8 LL a[20]; 9 LL gcd(LL a,LL b)10 {11 return b==0? a:gcd(b,a%b);12 }13 int main()14 {15 scanf("%s",num);16 int n=strlen(num);17 //printf("n==%d\n",n);18 int k=0;19 for(int i=0;i