第四次限时训练题目大意及ac代码
Atilla's Favorite Problem
题目大意
accode
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T;
cin >> T;
while (T--)
{
int n;
cin >> n;
string s;
cin >> s;
int x = 0;
for (int i = 0; i < s.size(); i++)
{
int t = s[i] - 'a' + 1;
x = max(t, x);
}
cout << x << "\n"
Minimum Varied Number
题目大意
accode
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[50];
int n;
signed main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T;
cin >> T;
while (T--)
{
cin >> n;
for (int i = 1; i <= 40; i++)
a[i] = 0;
int x = 9;
int k = 1;
while (n)
{
if (n >= x)
{
n -= x;
a[k] = x;
x--;
k++;
}
else
x--;
}
for (int i = k - 1; i >= 1; i--)
cout << a[i];
cout << "\n";
}
return 0;
}
Brain's Photos
题目大意
accode
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
using namespace std;
const int N = 20;
int main()
{
int n, m;
cin >> n >> m;
getchar();
string s[100];
for (int i = 0; i < n; i++)
{
getline(cin, s[i]);
}
bool temp = false;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < s[i].size(); j++)
{
if (s[i][j] == 'C' || s[i][j] == 'M' || s[i][j] == 'Y')
{
temp = true;
break;
}
}
}
if (temp) cout << "#Color" << endl;
else cout << "#Black&White" << endl;
return 0;
}
Soldier and Bananas
题目大意
accode
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
using namespace std;
const int N = 20;
int main()
{
int k, n, w;
cin >> k >> n >> w;
int sum = 0;
for (int i = 1; i <= w; i++)
{
sum += i;
}
if (n >= sum * k) cout << 0 << endl;
else cout << sum * k - n << endl;
return 0;
}
标签:ac,限时,cout,int,cin,--,大意,include
From: https://www.cnblogs.com/x1uc/p/17031651.html