-
Notifications
You must be signed in to change notification settings - Fork 0
/
BOJ_5355.cpp
51 lines (47 loc) · 804 Bytes
/
BOJ_5355.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<cmath>
#include<string>
#include<algorithm>
#include<cstring>
#include<functional>
#include<cstdio>
#include<stack>
#pragma warning(disable:4996)
#define INTMAX 0x7fffffff
#define gets(x) cin.getline(x,sizeof(x))
#define square(x) x*x
using namespace std;
using lld = long long;
using pii = pair<int, int>;
float solve(float num, char *str) {
for (int i = 1; i < strlen(str); i += 2) {
switch (str[i]) {
case '@':
num *= 3;
break;
case '%':
num += 5;
break;
case '#':
num -= 7;
break;
}
}
return num;
}
int main(void) {
int T;
float num;
char str[100];
scanf("%d", &T);
while (T--) {
scanf("%f", &num);
gets(str);
printf("%.2f\n",solve(num, str));
}
system("pause");
return 0;
}