恭喜Winners
liangxinzhu & techtbw
一血代码:
A:
Description
Solution
简单模拟。
Code
by e792a81
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using namespace std;
int main(){
char str[53];
while(cin.getline(str,52)){
for(int i=0; i<strlen(str); ++i){
if(isupper(str[i]))
str[i]=tolower(str[i]);
}
cout << str << endl;
}
return 0;
}
B:
Description
Solution
模拟题意。
Code
by liangxinzhu1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using namespace std;
typedef long long ll;
ll a, b;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
while(cin >> a >> b) {
if(a == b) {
cout << 0 << endl;
continue;
}
ll x = a - b;
if(x < 0) cout << '-', x = -x;
vector<char> v; int cnt = 0;
while(x) {
v.push_back((x % 10) + '0'), x /= 10, cnt++;
if(cnt % 3 == 0 && x) v.push_back(',');
}
reverse(v.begin(), v.end());
for(int i = 0; i < (int)v.size(); i++)
cout << v[i];
cout << endl;
}
return 0;
}
C:
Description
Solution
模拟
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
using namespace std;
int main(){
char c[100];
while(fgets(c,100,stdin)!=NULL){
for(int i=0;c[i];++i){
if(c[i]>='D'&&c[i]<='Z'||c[i]>='d'&&c[i]<='z')c[i]-=3;
else if(c[i]>='A'&&c[i]<='C'||c[i]>='a'&&c[i]<='c')c[i]+=23;
putchar(c[i]);
}
}
return 0;
}
D:
Description
Solution
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using namespace std;
char r[100011];
int main(){
int a,n,e;
while(~scanf("%d",&n)){
memset(r,0,100010);
for(int i=0;i<n-1;++i){
scanf("%d",&a);
r[a]=1;
}
for(int i=1;i<=n;++i){
if(!r[i]){
printf("%d",i);
break;
}
}
putchar('\n');
}
return 0;
}
E:
Description
Solution
map的简单运用
Code
by myfnb1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16int main(){
int n;
while(~scanf("%d", &n)){
map<string, int> mp;
for(int i = 1; i <= n; i++) {
string a;
cin >> a;
for(int j = 0; j < a.length(); j++) {
if(a[j] >= 'A' && a[j] <= 'Z') a[j] += 32;
}
mp[a]++;
}
printf("%d\n", mp.size());
}
return 0;
}
F:
Description
Solution
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using namespace std;
int main(){
char c[120],ps[100];
while(fgets(ps,100,stdin)!=NULL){
fgets(c,120,stdin);
for(int i=0;c[i];++i){
if(c[i]>='A'&&c[i]<='Z')c[i]=ps[c[i]-'A'];
else if(c[i]>='a'&&c[i]<='z')c[i]=('a'-'A')+ps[c[i]-'a'];
putchar(c[i]);
}
//putchar('\n');
}
return 0;
}
G:
Description
Solution
Code
by 200511535_ZBW
1 |
|
H:
Description
Solution
map的简单运用
Code
by myfnb1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22int main(){
int n;
while(~scanf("%d", &n)){
map<int, int> mp;
for(int i = 1; i <= n; i++) {
int x; scanf("%d", &x);
mp[x]++;
}
int ans = 0;
map<int,int> ::iterator it;
for(it = mp.begin(); it != mp.end(); it++) {
ans = max(ans, it->second);
}
for(it = mp.begin(); it != mp.end(); it++) {
if(it->second == ans) {
printf("%d %d\n", it->first, it->second);
break;
}
}
}
return 0;
}
I:
Description
Solution
Code
by techtbw1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using namespace std;
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
const int N=1010;
ll x,y,z;
void solve()
{
z=x+y;
int res=0;
while(z)
{
int t=z%10;
z/=10;
if(t==5) res++;
}
cout<<res<<endl;
}
int main()
{
int T;cin>>T;
while(T--)
{
cin>>x>>y;
solve();
}
return 0;
}
J:
Description
Solution
Code
by liangxinzhu1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using namespace std;
typedef long long ll;
string s;
ll cal(string str) {
ll res = 0;
for(int i = 0; i < (int)str.size(); i++) {
res = res * 10 + str[i] - '0';
}
return res;
}
void doit() {
vector<ll> v; string temp = "";
for(int i = 0; i < (int)s.size(); i++) {
if(s[i] == '5') {
if(temp.size()) v.push_back(cal(temp));
temp = "";
}else temp += s[i];
}
if(temp.size()) v.push_back(cal(temp));
sort(v.begin(), v.end());
for(int i = 0; i < (int)v.size(); i++)
cout << v[i] << (i != (int)v.size()-1 ? ' ' : '\n');
}
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
while(cin >> s) doit();
return 0;
}
K:
Description
Solution
Code
Nobody
L:
Description
Solution
正整数唯一分解
Code
by liangxinzhu
1 |
|
M:
Description
Solution
会读入就行了
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using namespace std;
char s[100000];
int ap[27];
int main(){
while(fgets(s,100000,stdin)!=NULL){
memset(ap,0,27*sizeof(int));
for(int i=0;s[i];++i){
if(s[i]>='a'&&s[i]<='z')
ap[s[i]-'a']++;
}
for(int i=0;i<26;++i){
printf("%c:%d\n",i+'a',ap[i]);
}
putchar('\n');
}
return 0;
}
N:
Description
Solution
Code
Nobody
O:
Description
Solution
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using namespace std;
int main(){
int a,b,c,d;
char e[100],f[100];
while(~scanf("%d%d%d",&a,&b,&c)){
if(a==b&&a==0)break;
sprintf(e,"%d",a);
sprintf(f,"%d",b);
for(int i=strlen(e)-1,j=strlen(f)-1;strlen(e)-i<=c;--i,--j){
if((i>=0?e[i]:'0')!=(j>=0?f[j]:'0'))break;
if(strlen(e)-i==c){
printf("-1");
goto endloop;
}
}
d=a+b;
printf("%d",d);
endloop:
putchar('\n');
}
return 0;
}
P:
Description
Solution
Code
by CUST_1903312031
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using namespace std;
int main(){
int n;
int r[1000];
int v;
int ans;
while(~scanf("%d",&n)){
ans=0;
if(!n)break;
for(int i=0;i<n;++i){
scanf("%d",r+i);
}
scanf("%d",&v);
for(int i=0;i<n;++i){
if(r[i]==v)ans++;
}
printf("%d\n",ans);
}
return 0;
}
Q:
Description
Solution
Code
by myfnb1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using namespace std;
typedef long long ll;
inline void print_Case(int cnt,ll ans)
{
printf("Case #%d: %lld\n",cnt,ans);
}
int f[1000005],m,prime[50005];
set<int>s;
void primes(int n)
{
m=0;
for(int i=2;i<=n;i++){
if(f[i]==0){
f[i]=i;
prime[++m]=i;
}
for(int j=1;j<=m;j++){
if(prime[j]>f[i]||prime[j]>n/i)break;
f[prime[j]*i]=prime[j];
}
}
}
const int N=5e5,M=5e6+5;
int a[5];
int main()
{
primes(10000);
for(int i=1;i<=m;i++)s.insert(prime[i]);
int n;
while(scanf("%d",&n)!=EOF){
int a=0,b=10000;
for(int i=1;i<=m;i++){
if(prime[i]>n/2)break;
if(s.find(n-prime[i])!=s.end()&&n-prime[i]-prime[i]<b-a&&n-prime[i]-prime[i]>=0){
a=prime[i];
b=n-prime[i];
}
}
printf("%d %d\n",a,b);
}
return 0;
}
R:
Description
Solution
简单数学
Code
by myfnb
1 | void solve(int kase){ |
S:
Description
Solution
映射关系
Code
by myfnb
1 | int a[3000 + 10]; |
T:
Description
Solution
欧拉函数
Code
by myfnb
1 | bool vis[N]; |
U:
Description
Solution
模拟?
Code
by myfnb1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32inline void print_Case(int cnt,ll ans)
{
printf("Case #%d: %lld\n",cnt,ans);
}
bool judge(int n)
{
int temp=0;
for(int i=1;i<=n-1;i++)
{
if(n%i==0)temp+=i;
}
if(temp==n)return true;
return false;
}
const int N=5e5,M=5e6+5;
int main()
{
int T;
cin>>T;
while(T--){
int n1,n2;
scanf("%d%d",&n1,&n2);
int ans=0;
if(n1>n2)swap(n1,n2);
if(n1<=6&&6<=n2)ans++;
if(n1<=28&&28<=n2)ans++;
if(n1<=496&&496<=n2)ans++;
if(n1<=8128&&8128<=n2)ans++;
printf("%d\n",ans);
}
return 0;
}
V:
Description
Solution
枚举
Code
by myfnb1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21int main()
{
int num;
while(scanf("%d",&num)!=EOF) {
int f=0;
for (int i = 1; i <= 100; i++) {
for (int j = i; j<= 100; j++) {
for (int k = j; k <= 100; k++) {
if (i * i + j * j + k * k == num) {
printf("%d %d %d\n", i, j, k);
f = 1;
break;
}
}
if(f)break;
}
if(f)break;
}
}
return 0;
}
W:
Description
Solution
Code
Nobody
X:
Description
Solution
进制转换
Code
by cyh200212311
2
3
4
5
6
7
8
9
int main()
{
int a, b;
while(scanf("%x%x", &a, &b) != EOF) {
printf("%d\n", a + b);
}
return 0;
}
Y:
Description
Solution
枚举?
Code
by myfnb
1 | bool judge(int n) |
Z:
Description
Solution
Code
Nobody