There is a river of width n">nn. The left bank of the river is cell 0">00 and the right bank is c ...
傳送門 A. Payment Without Change 簽到。 Code B. Minimize the Permutation 題意: 給出一個 n 的排列,現在對於一個位置 i ,可以交換 a i,a i 。但要滿足每個位置只能交換一次且最多交換 n 次。 輸出操作過后字典序最小的序列。 思路: 直接從后往前每個位置不斷貪心考慮即可。 每次掃一遍序列至少會交換一次,所以復雜度為 O n 。 ...
2019-11-05 11:47 0 276 推薦指數:
There is a river of width n">nn. The left bank of the river is cell 0">00 and the right bank is c ...
E. Yet Another Division Into Teams There are n students at your university. The programming skill o ...
F. Equalizing Two Strings You are given two strings s and t both of length n and both consisting of ...
https://codeforces.com/contest/1256 A:Payment Without Change【思維】 題意:給你a個價值n的物品和b個價值1的物品,問是否存在取物方案使得價值為s 題解:min(s/n,a)*n+b>=s?YES:NO B ...
Codeforces Round #739 (Div. 3) div3掉大分,不考算法考手速真來不及,還是得多練 目錄: A. Dislike of Threes B. Who's Opposite? C. Infinity Table D. Make a Power of Two ...
A. ConneR and the A.R.C. Markland-N 題目鏈接:https://codeforces.com/contest/1293/problem/A 題意: 有一個長為 n 的樓層,其中有 k 個樓層沒有餐廳 ,你現在在 s 層,問你最少走多少個樓層可以到達餐廳吃飯 ...
A. Collecting Coins 題目鏈接:https://codeforces.com/contest/1294/problem/A 題意: 你有三個姐妹她們分別有 a , b , c枚硬幣,你有n枚,你可以把硬幣隨意分給她們(必須分完),使她們的硬幣數A = B = C 分析 ...
比賽鏈接:https://codeforces.com/contest/1333 比賽的時候,寫D的時候用了cin,cout的優化結果還是被卡了,看來cin,cout得少用。 A - Little Artem 給你n * m的矩陣,只有B和W,相鄰有其他不一樣的點成為好點,讓好點B ...