-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path0047.cpp
More file actions
34 lines (32 loc) · 783 Bytes
/
0047.cpp
File metadata and controls
34 lines (32 loc) · 783 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
// 0047.线性插值
// PS: 这题指的重复数据,连续两个编号相同的数据使用第一组。
#include <iostream>
#include <map>
using namespace std;
int main()
{
int m, n, a, b, c, d;
while (cin >> m >> n)
{
map<int, int> mp;
cin >> a >> b;
mp[a] = b;
cout << a << ' ' << b << endl;
for(int i = 0; i < m-1; i++)
{
cin >> c >> d;
if ( c == a ) continue;
mp[c] = d;
if (c - a > 1) {
for(int i = 1; i < c-a; i++)
{
cout << a+i << ' ' << b+(d-b)/(c-a)*i << endl;
}
}
cout << c << ' ' << d << endl;
a = c;
b = d;
}
}
return 0;
}