题目链接
逆天抽象局,ab都是构造题,
A. Find K
Distinct Points with Fixed Center
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
| #include<iostream> #define int long long using namespace std;
int t , x , y , k; signed main(){ cin >> t; while( t -- ){ cin >> x >> y >> k; if( k % 2 ){ cout << x << " " << y << endl; for(int i = 1;i <= (k-1)/2;i ++){ cout << x-i << " " << y << endl; cout << x+i << " " << y << endl; } } else{ for(int i = 1;i <= k/2;i ++){ cout << x-i << " " << y << endl; cout << x+i << " " << y << endl; } } } return 0; }
|
B. Minimize
Equal Sum Subarrays
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include<iostream> #define int long long using namespace std;
const int N = 2e5; int n; int a[N+10];
signed main(){ int t;cin >> t; while( t -- ){ cin >> n; for(int i = 1;i <= n;i ++){ cin >> a[i]; } for(int i = 2;i <= n;i ++){ cout << a[i] << " "; }cout << a[1] << endl; } return 0; }
|