X - A == B ?(第二季水)
Description
Input
Output
Sample Input
Sample Output
#include<iostream>
#include<string.h>
using namespace std;
char a[2],b[2];
void f(char s[])
{
int n;
n=strlen(s);
while(){
if(s[]==''){
for(int j=;j<n;j++){
s[j]=s[j+];
}
n--;
}
else break;
}
if(strchr(s,'.')){
for(int i=n-;i>=;i--){
if(s[i]==''){
s[i]='\0';
n--;
}
else break;
}
}
if(s[n-]=='.')s[n-]='\0';
}
int main()
{
while(cin>>a>>b){
f(a);
f(b);
if(strcmp(a,b))cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return ;
}
以下为AC代码
#include<iostream>
#include<string.h>
using namespace std;
char a[],b[];
void f(char s[])
{
int n=strlen(s);
if(strchr(s,'.')!=NULL){
for(int i=n-;i>=;i--){
if(s[i]==''){
s[i]='\0';
n--;
}
else break;
}
}
if(s[n-]=='.')s[n-]='\0';
}
int main()
{
while(cin>>a>>b){
f(a);
f(b);
if(strcmp(a,b))cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return ;
}
X - A == B ?(第二季水)的更多相关文章
- F - The Fun Number System(第二季水)
Description In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight o ...
- D - Counterfeit Dollar(第二季水)
Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...
- S - 骨牌铺方格(第二季水)
Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种, ...
- R - 一只小蜜蜂...(第二季水)
Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. ...
- I - Long Distance Racing(第二季水)
Description Bessie is training for her next race by running on a path that includes hills so that sh ...
- Y - Design T-Shirt(第二季水)
Description Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA ...
- N - Robot Motion(第二季水)
Description A robot has been programmed to follow the instructions in its path. Instructions for the ...
- B - Maya Calendar(第二季水)
Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...
- T - 阿牛的EOF牛肉串(第二季水)
Description 今年的ACM暑期集训队一共有18人,分为6支队伍.其中有一个叫做EOF的队伍,由04级的阿牛.XC以及05级的COY组成.在共同的集训生活中,大家建立了深厚的 ...
- E - Number Sequence(第二季水)
Description A single positive integer i is given. Write a program to find the digit located in the p ...
随机推荐
- 新浪授权认证(不用SDK)
微博开放平台:http://open.weibo.com/ 微博开放接口的调用,如发微博.关注等,都是需要获取用户身份认证的.目前微博开放平台用户身份鉴权主要采用的是OAuth2.0.另外,为了方便开 ...
- 获取UILabel上最后一个字符串的位置。获取文字长度和高度,自动换行
//行的高度. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPat ...
- QT错误:collect2:ld returned 1 exit status
1.编译成功的例子在后台执行,有时一闪而过,如果再次build ,则会提示上述错误. 解决方法:打开任务管理器,找到相应的exe进程,关闭即可: 或者直接关闭QtCreator. 2.没有编译成功的 ...
- Python codes
Vertification of an assignment from Stochastic Processing. Using Brute Force and "itertools&quo ...
- (原+转)C++中的lambda表达式
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5073376.html 参考网址: http://www.cnblogs.com/zhuyp1015/a ...
- tomact虚拟目录,虚拟主机,http请求头,相应头
tomact虚拟目录,虚拟主机,http请求头,相应头 07. 五 / J2EE / 没有评论 一.服务器,容器(软件)1.服务器:提供网络访问的程序2.容器:支持什么技术的服务器就叫做什么容器. ...
- HTTP协议入门知识
HTTP超文本传输协议,是客户端浏览器和服务器通信的规范,是浏览器与服务器通信的协议,属于应用层的协议,web开发者了解HTTP协议非常重要.浏览器通过http协议请求服务器,完成请求服务器立刻关闭连 ...
- JavaScript开发规范
作为一名开发人员(WEB前端JavaScript开发),不规范的开发不仅使日后代码维护变的困难,同时也不利于团队的合作,通常还会带来代码安全以 及执行效率上的问题.本人在开发工作中就曾与不按规范来开发 ...
- 海量数据处理利器greenplum——初识
简介及适用场景 如果想在数据仓库中快速查询结果,可以使用greenplum. Greenplum数据库也简称GPDB.它拥有丰富的特性: 第一,完善的标准支持:GPDB完全支持ANSI SQL 200 ...
- SQL Server 2008空间数据应用系列二:空间索引(Spatial Index)基础
原文:SQL Server 2008空间数据应用系列二:空间索引(Spatial Index)基础 在前一篇博文中我们学习到了一些关于地理信息的基础知识,也学习了空间参照系统,既地球椭球体.基准.本初 ...