标签:tps 出现 cout oid you names str pac mes
A Sequence with Digits standard input/output 1 s, 256 MB Submit Add to favourites x14744
a的通项中一定会有一个出现数字0, 自此之后的a不变化, 判断一下即可 最长的是 a1 = 54, 28217才出现一个数字0, 因为每次加的数字 0-81 所以一定会把百位变成0
B Young Explorers standard input/output 2 s, 256 MB Submit Add to favourites x13448
排个序, 然后从最少经验的人开始组队 这样组的队数量一定是最大的, 贪心呗
C Count Triangles standard input/output 1 s, 256 MB Submit Add to favourites x6332
D Game With Array standard input/output 1 s, 256 MB Submit Add to favourites x10298
E Restorer Distance standard input/output 1 s, 256 MB Submit Add to favourites x2617
#include <bits/stdc++.h> using namespace std; #define ll long long #define all(v) (v).begin(), (v).end() #define _for(i,a,b) for(int i = (a); i < (b); i++) #define _rep(i,a,b) for(int i = (a); i <= (b); i++) //643 (Div. 2)
ll getadd(ll x) { ll a = 0, b = 9; while(x > 0) { a = max(x%10, a); b = min(x%10, b); x /= 10; } return a*b; } void taskA() { int t; cin >> t; while(t--) { ll a,k; cin >> a >> k; _rep(i,2,k) { ll b = getadd(a); if(!b) break; a = a+b; } cout << a << "\n"; } return; }
void taskB() { int t; cin >> t; while(t--) { int n; cin >> n; vector<int> a(n); _for(i,0,n) cin >> a[i]; sort(all(a)); int cnt = 0, x = 0; _for(i,0,n) { if(++x >= a[i]) cnt++, x = 0; } cout << cnt << "\n"; } return; }
int main(){ ios::sync_with_stdio(false), cin.tie(nullptr); //taskA(); //taskB(); taskC(); return 0; }
标签:tps 出现 cout oid you names str pac mes
原文地址:https://www.cnblogs.com/163467wyj/p/13090365.html