-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1703.cpp
More file actions
46 lines (38 loc) · 693 Bytes
/
1703.cpp
File metadata and controls
46 lines (38 loc) · 693 Bytes
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
// 1703. 생장점
// 2022.05.17
// 수학
#include<iostream>
#include<vector>
using namespace std;
vector <int> v;
int main()
{
int a;
int ans = 1;
while (1)
{
cin >> a;
if (a == 0)
{
break;
}
// init
v.resize(a * 2);
ans = 1;
// input
for (int i = 0; i < 2 * a; i++)
{
cin >> v[i];
}
// calculate
for (int i = 0; i < a; i++)
{
int splitingFactor = v[i * 2];
int cut = v[i * 2 + 1];
ans = ans * splitingFactor - cut;
}
// output
cout << ans << endl;
}
return 0;
}