Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- char s[20];
- int main()
- {
- int len,i,test,tc,num1,num2;
- scanf("%d",&test);
- getchar();
- for(tc=1; tc<=test; tc++)
- {
- gets(s);
- len = strlen(s);
- num1 = num2 = 0;
- bool flag = true;
- for(i=0; i<len; i++)
- {
- if(isdigit(s[i]) && flag)
- {
- while(isdigit(s[i]))
- {
- num1 = num1*10+(s[i]-48);
- i++;
- }
- flag = false;
- }
- if(!flag)
- {
- while(isdigit(s[i]))
- {
- num2 = num2*10+(s[i]-48);
- i++;
- }
- }
- }
- int num = num1*.5+num2*.05;
- double ans = num1*.5+num2*.05;
- if(num==ans)
- {
- printf("Case %d: %d\n",tc,num);
- }
- else
- {
- printf("Case %d: %g\n",tc,ans);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment