Codeforces Round #527 (Div. 3) A. Uniform String(水題)
題目連結:http://codeforces.com/contest/1092/problem/A
題意:給你n輸出長度為n字串,k是迴圈的長度,比如k為3就是abc迴圈,k為4就是abcd迴圈。
#include <bits/stdc++.h> using namespace std; int t, n, k; int main() { cin >> t; while (t--) { cin >> n >> k; for (int i = 1; i <= n; i++) cout << char((i - 1) % k + 'a'); cout << endl; } return 0; }
相關推薦
Codeforces Round #527 (Div. 3) A. Uniform String(水題)
題目連結:http://codeforces.com/contest/1092/problem/A 題意:給你n輸出長度為n字串,k是迴圈的長度,比如k為3就是abc迴圈,k為4就是abcd迴圈。 #include <bits/stdc++.h> using namespac
Codeforces Round #527 (Div. 3) A. Uniform String
A. Uniform String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You
Codeforces Round #527 (Div. 3) CF1092A Uniform String
題目:Uniform String 思路: 每次輸出的形式都形如 abcdabcdabc 這樣的,k個字母迴圈輸出。 只需要寫一個迴圈維護一下就好了。 程式碼: #include<bits/stdc++.h> using namespace s
Codeforces Round #527 (Div. 3) B. Teams Forming(水題)
題目連結:http://codeforces.com/contest/1092/problem/B 題意:給你n個人,要給他們兩個兩個分組,要儘量讓他們的權值之差最小,問總差值是多少。 #include <bits/stdc++.h> using namespace std;
Codeforces Round #247(Div. 2) A. Black Square 水題
A. Black Square time limit per test 1 second memory limit per test 256 megabytes i
Codeforces Round #493 (Div. 2) A. Balloons 貪心水題
由於是輸出任意一組解,可以將價值從小到大進行排序,第一個人只選第一個,第二個人選其餘的。再比較一下第一個人選的元素和第二個人所選元素和是否相等即可。由於已將所有元素價值從小到大排過序,這樣可以保證在有解的情況下一定可以構造出可行解。 Code: #include
【Codeforces Round 332 (Div 2)A】【水題】A. Patrick and Shopping 遍歷三元環的最小成本
Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his hous
Codeforces Round #527 (Div. 3) 總結 A B C D1 D2 F
傳送門 A 貪心的取 每個字母n/k次 令r=n%k 讓前r個字母各取一次 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 #define rep(i, a, b) f
Codeforces Round #527 (Div. 3) C. Prefixes and Suffixes (string+multiset+思維)
C. Prefixes and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output
Codeforces Round #486 (Div. 3) A. Diverse Team
pre table ngs href AI pop ons NPU school Codeforces Round #486 (Div. 3) A. Diverse Team 題目連接: http://codeforces.com/contest/988/problem/
Codeforces Round #501 (Div. 3) A Points in Segments
segments ble round show 默認 () for using pre 翻譯 現在有一個數軸,上面會有\(M\)個點,標號為\(1\)到\(N\),現在給你在數軸上的條\(N\)線段的起始與終止的點,問哪幾個點沒有被這樣線段覆蓋,從小到大輸出。 思路 簽到題
Codeforces Round #515 (Div. 3) A(思維)
題意:找1~L之間 v 的倍數的個數,在區間[l,r]之間的不能算 思路:1到n之間v的倍數個數為n/v向下取整,因為是閉區間,所以區間裡v的倍數個數為r/v-(l-1)/v,l為什麼要減一?因為l-1/v是1到l-1中v的倍數個數。 #include<bits/stdc++.h>
CodeForces Round #498 Div.3 A. Adjacent Replacements
http://codeforces.com/contest/1006/problem/A Mishka got an integer array aa of length nn as a birthday present (what a surp
Codeforces Round #521 (Div. 3) A 模擬 B 貪心 C模擬 D 二分 E 二分+排序
A Code: #include <bits/stdc++.h> #define LL long long using namespace std; int main(){ int T ; cin >> T ; int a , b , k ;
Codeforces Round #521 (Div. 3) A. Frog Jumping
題解 題目大意 一個人從0開始偶數向右走a 奇數向左走b 問k次走多遠 偶數部分b和a抵消了一部分 奇數再加一個a即可 AC程式碼 #include <stdio.h> #include <bits/stdc++.h> using namespace
Codeforces Round #515 (Div. 3)A. Vova and Train【水題】
A. Vova and Train time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vova
Codeforces Round #521 (Div. 3) A B C D E
A. Frog Jumping 題目連結:https://codeforces.com/contest/1077/problem/A 題目大意:t組測試資料,從0開始,向前跳a,向後跳b,跳k次,輸出最後所在的位置。 題解:大水題,直接輸出就行了 int main() { std:
【題解】codeforces1029A[Codeforces Round #506 (Div. 3)]A.Many Equal Substrings KMP
題目連結 Description You are given a string ttt consisting of nnn lowercase Latin letters and an integer number kkk. Let’s define a sub
Codeforces Round #515 (Div. 3) A. Vova and Train
題解 題目大意 總長度為L 每到v的倍數位置都有一個路燈 現有一火車在[l, r]問在火車遮擋後 能看見多少個路燈 (r - 1) / v計算左側出現路燈數量L / v - r / v計算右側出現路燈數量 AC 程式碼 #include <stdio.h&
Codeforces Round #515 (Div. 3) A、B、C、D
A. Vova and Train time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vo