Codeforces A. Add Candies (#683 Div.2 by Meet IT) (思維 / 水題)
題意: 有n包糖果,第i包裡有i顆,目標是要讓所有糖包裡的糖果一樣多。可進行m次操作,第j次操作將j顆糖果新增在所選糖包外的糖包裡。輸出操作次數及每次操作的a[j]。
思路: 直接輸出1到n即可。
程式碼實現:
#include<bits/stdc++.h>
#define endl '\n'
#define null NULL
#define ll long long
#define int long long
#define pii pair<int, int>
#define lowbit(x) (x &(-x))
#define ls(x) x<<1
#define rs(x) (x<<1+1)
#define me(ar) memset(ar, 0, sizeof ar)
#define mem(ar,num) memset(ar, num, sizeof ar)
#define rp(i, n) for(int i = 0, i < n; i ++)
#define rep(i, a, n) for(int i = a; i <= n; i ++)
#define pre(i, n, a) for(int i = n; i >= a; i --)
#define IOS ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int way[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
using namespace std;
const int inf = 0x7fffffff;
const double PI = acos(-1.0);
const double eps = 1e-6;
const ll mod = 1e9 + 7;
const int N = 2e5 + 5;
int t, n;
signed main()
{
IOS;
cin >> t;
while(t --){
cin >> n;
for(int i = 1; i <= n; i ++) cout << i << " ";
cout << endl;
}
return 0;
}
相關文章
- Codeforces Round #190 DIV.2 A. Ciel and Dancing
- Codeforces Round 942 Div.2 題解
- Codeforces Round 960 (Div.2) 補題
- Codeforces Round 689(Div.2) E題 Water Level
- Codeforces Round 957 (Div.2)(A-D題解)
- Codeforces Round #953 (Div.2)
- Codeforces Round #469 C A. Zebras
- Codeforces #208 div2前兩題及思維風暴
- Codeforces Round #242 (Div. 2) A. Squats
- Codeforces Testing Round #10 A. Forgotten EpisodeGo
- CodeForces - 1430D String Deletion (思維)
- C. Lose it!(思維)Codeforces Round #565 (Div. 3)
- Codeforces Round #213 (Div. 2) A. Good NumberGo
- Codeforces Round #243 (Div. 2) A. Sereja and Mugs
- Codeforces Round #253 (Div. 2) A. Anton and Letters
- Codeforces Round #250 (Div. 2) A. The Child and Homework
- Codeforces Round #244 (Div. 2) A. Police RecruitsUI
- CodeForces - 976A:Minimum Binary Number(水題)
- 【CodeForces】 Codeforces Round #672 (Div. 2) B.Rock and Lever (思維&位運算)
- Codeforces Round #225 (Div. 2)(B思維題,E:dfs+樹狀陣列)陣列
- Codeforces Beta Round #76 (Div. 1 Only) A. Frames
- Codeforces Round #249 (Div. 2) A. Black Square
- Codeforces Round #246 (Div. 2) A. Choosing Teams
- Codeforces Round #216 (Div. 2)A. Valera and Plates
- Codeforces Round #209 (Div. 2) A. Table
- Codeforces Round #210 (Div. 2) A. Levko and Table
- Codeforces Round #192 (Div. 2) A. Cakeminator
- Codeforces Round #189 (Div. 2) A. Magic Numbers
- 思維體系---技術思維、業務資料思維、產品思維、複合思維
- codeforces round #234B(DIV2) B Inna and New Matrix of Candies
- 組合計數思維題
- 思維題專項訓練
- Codeforces Round #228 (Div. 2) A. Fox and Number GameGAM
- Codeforces Round #215 (Div. 2) A. Sereja and Coat Rack
- Codeforces Round #248 (Div. 2) A. Kitahara Haruki's Gift
- Codeforces Round #235 (Div. 2) A. Vanya and Cards
- codeforces round #201 Div2 A. Difference Row
- Codeforces Round #207 (Div. 2) A. Group of Students