CodeForces 41A+43A【课上无聊刷水题系列】
41Acode
好像只要前一个字符串存在下一个字符串的头单词就YES;
#include <bits/stdc++.h>
using namespace std;
typedef __int64 LL;
const int N=1e2+10;
int main()
{
int len,i,j;
char s1[N],s2[N];
scanf("%s%s",s1,s2);
len=strlen(s1);
for(i=0,j=len-1;i<len;i++,j--)
{
if(s1[i]!=s2[j])
{
puts("NO");
return 0;
}
}
puts("YES");
return 0;
}
43A
利用map遍历;
原来map的迭代器是iterator
#include <bits/stdc++.h>
using namespace std;
typedef __int64 LL;
map<string,int>mp;
string ss,ans;
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
cin>>ss;
mp[ss]++;
}
map<string,int>::iterator it;
int tmp=0;
for(it=mp.begin();it!=mp.end();it++)
{
if(it->second>tmp)
{
tmp=it->second;
ans=it->first;
}
}
cout<<ans<<endl;
return 0;
}
CodeForces 41A+43A【课上无聊刷水题系列】的更多相关文章
- [洛谷U22157]刷水题(数位dp)(hash)
题目背景 做正经题是不可能做正经题的,这辈子都不可能做正经题的,毒瘤题又不会做毒瘤题,就是水题这种东西,才维持了蒟蒻的信心: 题目描述 这里有N+1 道水题,编号分别为0 ~N+1 ,每道水题都有它自 ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- nyoj 1208——水题系列——————【dp】
水题系列 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 给你一个有向图,每条边都有一定的权值,现在让你从图中的任意一点出发,每次走的边的权值必须必上一次的权 ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
- Educational Codeforces Round 14 A. Fashion in Berland 水题
A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- Codeforces Round #190 (Div. 2) 水果俩水题
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...
- Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告
对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...
- Codeforces 777D:Cloud of Hashtags(水题)
http://codeforces.com/problemset/problem/777/D 题意:给出n道字符串,删除最少的字符使得s[i] <= s[i+1]. 思路:感觉比C水好多啊,大概 ...
随机推荐
- python的id()函数的一个小方面(转载)
>>> a = 2 >>> b = 2 >>> id(a) 21132060 >>> id(b) 21132060 >&g ...
- c# 委托 Predicate的使用示例
一.说明 委托Predicate 可以有参数(比如下面的示例),也可以不带参数,委托Predicate是返回固定值bool值的委托 二.示例代码(控制台程序) using System; using ...
- go签名算法设计
Go by Example 中文:Base64编码 https://books.studygolang.com/gobyexample/base64-encoding/
- file descriptor 0 1 2 一切皆文件 stdout stderr stdin /dev/null 沉默是金 pipes
$>emtry_or_create_a_file.f $ll>>append_a_file.f standard output input error $ls -l /usr/bin ...
- SpringBoot-(1)-IDEA创建SpringBoot项目并运行访问接口
一,安装IDEA mac安装IDEA IDEA配置Tomcat 二,创建SpringBoot项目 1,打开IDEA,点击Create New Project 2,选择自己所安装的JDK.如果没有配置J ...
- 将自定义参数从uboot传入kernel的并读取的方法【转】
本文转载自:http://blog.csdn.net/qq_29729577/article/details/50580727 希望朋友们多多指点,好的技术或心得一起分享: uboot向kernel传 ...
- 分布式锁(Zookeeper实现)
分布式锁 分布式锁,这个主要得益于 ZooKeeper 为我们保证了数据的强一致性.锁服务可以分为两类,一个是 保持独占,另一个是 控制时序. 1. 所谓保持独占,就是所有试图来获取这个锁的客户端,最 ...
- 基于BASYS2的VHDL程序与烧写——按键消抖程序
请尊重作者版权,转载请注明源地址http://www.cnblogs.com/connorzx/p/3548364.html 按键在按下的过程中通常会产生一段时间的抖动,为了消除这种抖动,一般采取两种 ...
- IPFS 到底是怎么工作的?
简介 我们知道,一个存储服务,最基本的功能就是存和取.IPFS 中提供了这两种语义,那就是 add 和 get 操作. 在 IPFS 系统中执行 add 操作,就是执行了一次存操作,放在网络的概念里, ...
- xml文件的解析(用dom4j解析)
有个第三方的包,用来解析.xml文件比较方便,它是DOM4J.由于是第三方的,所以要使用它就要先下载,并包含进来.步骤: 1.打开dom4j官网,这里下载最新版dom4j-2.1.1.jar. 2.新 ...