codeforces 554

A:多给一个字母问能形成多少种字符串= =

#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <queue>

#include<bits/stdc++.h>

#include <string.h>

using namespace std;

int main()

{

char a[10001];

gets(a);

int len=strlen(a);

if(len==1) printf("%d\n",51);

if(len>=2)

{

printf("%d\n",(len+1)*26-len); //很容易想到,,找找规律就有了

}

return 0;

}

B:抽象为看一样的行最多有多少个。。。。。,,注意起始是1

#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <queue>

#include<bits/stdc++.h>

#include <string.h>

using namespace std;

int main()

{

int m;

char a[101][101];

scanf("%d",&m);

int i,j;

for(i=0;i<m;i++)

{

scanf("%s",a[i]);

}

int ans=1;

for(i=0;i<m-1;i++)

{

int sum=1;

for(j=i+1;j<m;j++)

{

if(strcmp(a[i],a[j])==0) sum++;

}

ans=max(ans,sum);

}

printf("%d\n",ans);

return 0;

}

(C与前面一篇重了)

DE看人数没敢做= = 

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-07 12:09:03

codeforces 554的相关文章

Codeforces Round #554(div. 2)

距离上次打cf已经不知道过了多久,看到最近的contest都很水,于是想上上分,然后就3题滚了……(顺便吐槽cf好卡 题目链接:http://codeforces.com/contest/1152 A: 一眼题,奇+偶才能等于奇 1 #include <bits/stdc++.h> 2 /* define */ 3 #define ll long long 4 #define dou double 5 #define pb emplace_back 6 #define mp make_pair

Codeforces Round #554 (Div. 2) C.Neko does Maths (gcd的运用)

题目链接:https://codeforces.com/contest/1152/problem/C 题目大意:给定两个正整数a,b,其中(1<=a,b<=1e9),求一个正整数k(0<=k),使得a+k与b+k的最小公倍数最小. 解题思路:首先我们需要知道gcd(a,b)=gcd(a,b-a)=gcd(b,b-a)(b>a)的 我们要求的是lcm(a+k,b+k)=(a+k)(b+k)/gcd(a+k,b+k)=(a+k)(b+k)/gcd(a+k,b-a) 因为b-a是定值,所

Codeforces Round #554 (Div. 2) 1152C. Neko does Maths

学了这么久,来打一次CF看看自己学的怎么样吧 too young too simple 1152C. Neko does Maths 题目链接:"https://codeforces.com/contest/1152/problem/C" 题目大意:给你两个数a,b,现在要你找出一个数k使得(a+k)和(b+k)的最小公倍数最小. 题目思路:暴力(逃) 这题没得思路,想了想既然求LCM了那么和GCD说不定有点关系 然后就没有然后了 比赛的时候交了一发暴力上去,然并软 赛后补题,题解里面

Codeforces Round #554 (Div. 2) C. Neko does Maths (数论 GCD(a,b) = GCD(a,b-a))

传送门 •题意 给出两个正整数 a,b: 求解 k ,使得 LCM(a+k,b+k) 最小,如果有多个 k 使得 LCM() 最小,输出最小的k: •思路 时隔很久,又重新做这个题 温故果然可以知新? 重要知识点 GCD(a,b)=GCD(a,b-a)=GCD(b,b-a) (b>a) 证明: 设GCD(a,b)=c 则a%c=0,b%c=0,(b-a)%c=0 所以GCD(a,b-a)=c 得GCD(a,b)=GCD(a,b-a) gcd(a+k,b-a)肯定是(b-a)的因子 所以gcd(a

B. Ohana Cleans Up(Codeforces Round #309 (Div. 2))

B. Ohana Cleans Up Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom is very strange: if she swe

【codeforces 718E】E. Matvey&#39;s Birthday

题目大意&链接: http://codeforces.com/problemset/problem/718/E 给一个长为n(n<=100 000)的只包含‘a’~‘h’8个字符的字符串s.两个位置i,j(i!=j)存在一条边,当且仅当|i-j|==1或s[i]==s[j].求这个无向图的直径,以及直径数量. 题解:  命题1:任意位置之间距离不会大于15. 证明:对于任意两个位置i,j之间,其所经过每种字符不会超过2个(因为相同字符会连边),所以i,j经过节点至多为16,也就意味着边数至多

Codeforces 124A - The number of positions

题目链接:http://codeforces.com/problemset/problem/124/A Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing b

Codeforces 841D Leha and another game about graph - 差分

Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or  - 1. To pass th

Codeforces Round #286 (Div. 1) A. Mr. Kitayuta, the Treasure Hunter DP

链接: http://codeforces.com/problemset/problem/506/A 题意: 给出30000个岛,有n个宝石分布在上面,第一步到d位置,每次走的距离与上一步的差距不大于1,问走完一路最多捡到多少块宝石. 题解: 容易想到DP,dp[i][j]表示到达 i 处,现在步长为 j 时最多收集到的财富,转移也不难,cnt[i]表示 i 处的财富. dp[i+step-1] = max(dp[i+step-1],dp[i][j]+cnt[i+step+1]) dp[i+st