这道题提醒我两点:

1.break时一定要检查清楚

2.字符串直接赋值一定要注意结束符,最好能用strcpy

以上是debug的惨痛教训

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
using namespace std; #define MEM(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define debug printf("!/n")
#define INF 1000
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long char str[]; int main()
{
int n,i,j;
while(~sf("%d",&n))
{
int cnt = ;
bool flag=false;
for(i = ;i<n;i++)
{
char tmp[];
sf("%s",tmp); if(tmp[]=='')
{
flag = true;
continue;
} if(tmp[]!='')
{
strcpy(str,tmp);
continue;
}
else
{
int len = strlen(tmp); for(j = ;j<len;j++)
{
if(tmp[j]!='')
{
strcpy(str,tmp);
break;
}
cnt++;
}
}
}
if(flag)
{
pf("0\n");
continue;
}
if(strlen(str)==)
{
pf("1\n");
continue;
}
pf("%s",str);
while(cnt--){pf("");}
blank;
}
return ;
}

CodeForce 614B Gena's Code(水题)的更多相关文章

  1. Codeforces Round #339 (Div. 2) B. Gena's Code 水题

    B. Gena's Code 题目连接: http://www.codeforces.com/contest/614/problem/B Description It's the year 4527 ...

  2. HDU 4813 Hard Code 水题

    Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  3. Best code水题之路

    BestCoder 2nd Anniversary: 1001.Oracle There is once a king and queen, rulers of an unnamed city, wh ...

  4. CodeForces 614B Gena's Code

    #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm& ...

  5. CODE FESTIVAL 2017 qual B B - Problem Set【水题,stl map】

    CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: ...

  6. [CodeForces - 614B] B - Gena's Code

    B - Gena's Code It's the year 4527 and the tanks game that we all know and love still exists. There ...

  7. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar 水题

    A. Checking the Calendar 题目连接: http://codeforces.com/contest/724/problem/A Description You are given ...

  8. codeforce A. 2Char(水题,暴力)

    今晚发了个蛇精病,然后CF了,第一题这好难啊,然而水题一个,暴力飘过. 链接http://codeforces.com/contest/593/problem/A: 题意比较难懂吗?傻逼百度都翻译不对 ...

  9. Codeforces Round #339 Div.2 B - Gena's Code

    It's the year 4527 and the tanks game that we all know and love still exists. There also exists Grea ...

随机推荐

  1. Maven镜像更换为阿里云中央仓库(精)

    前言 maven仓库默认在国外,使用难免很慢,尤其是下载依赖的时候,换为国内镜像,让你感受飞一般的感觉.国内支持maven镜像的有阿里云,开源中国等,这里换为阿里云的. 更换 修改maven配置文件s ...

  2. [Objective-C语言教程]复合对象(33)

    在Objective-C中,可以在类集群中创建子类,该类集合定义了一个嵌入在其中的类. 这些类对象是复合对象.你可能想知道什么是类集群,下面首先了解什么是类集群. 1. 类集群 类集群是基础框架广泛使 ...

  3. springboot 配置webservice接口

    导入依赖的jar <!-- webservice cxf --> <dependency> <groupId>org.apache.cxf</groupId& ...

  4. python-------打印与字符串格式化

    print python中每次执行print时都会在新的一行上开始.形如:print(’xiao') print('ming') 结果为:>>>xiao >>>mi ...

  5. python --爬虫基础 --爬猫眼top 100 使用 requests 库的基本操作

    import requests import re import json import time def get_page(url): # 获取页数 headers = { 'User-Agent' ...

  6. Linux运维: Rsync同步数据(ubuntu16.04+windows10)

    rsync同步数据 -环境:Linux (ubuntu16.04) + windows10 Linux: 安装 sudo apt-get install rsync rsync --version 查 ...

  7. POJ 2196

    #include <iostream> using namespace std; int sum_10; int sum_12; int sum_16; int fun_10(int nu ...

  8. 一段话理解 MDX中的Select 、轴、COLUMNS、ROWS

    理解 SELECT  Understanding the SELECT statement SELECT 语句的目的是定义新的 Cube 空间,新的Cube 空间是由类似于 COLUMNS或者ROWS ...

  9. 关于npm run dev报错npm ERR! missing script: dev

    出现这个问题应当重新使用 vue init webpack 来初始化工程. 在执行 npm run dev 就可以执行了.

  10. 使用go写一个简单的exe文件

    工作需要一个小工具给分析师用,原先打算写一个脚本的,但是呢我又不会用python,要写的话只能用java来实现(打包成可执行jar,使用java -jar 的命令来执行,当然得安装jdk).这种命令行 ...