CodeForce 614B Gena's Code(水题)
这道题提醒我两点:
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(水题)的更多相关文章
- 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 ...
- HDU 4813 Hard Code 水题
Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- Best code水题之路
BestCoder 2nd Anniversary: 1001.Oracle There is once a king and queen, rulers of an unnamed city, wh ...
- CodeForces 614B Gena's Code
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm& ...
- CODE FESTIVAL 2017 qual B B - Problem Set【水题,stl map】
CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: ...
- [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 ...
- 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 ...
- codeforce A. 2Char(水题,暴力)
今晚发了个蛇精病,然后CF了,第一题这好难啊,然而水题一个,暴力飘过. 链接http://codeforces.com/contest/593/problem/A: 题意比较难懂吗?傻逼百度都翻译不对 ...
- 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 ...
随机推荐
- 实时监测input输入变化 jQuery
$('#production_name').on('input propertychange',function(){ alert('输入一个字弹一回'); });
- leetcode-849-到最近的人的最大距离
题目描述: 在一排座位( seats)中,1 代表有人坐在座位上,0 代表座位上是空的. 至少有一个空座位,且至少有一人坐在座位上. 亚历克斯希望坐在一个能够使他与离他最近的人之间的距离达到最大化的座 ...
- date命令的基本用法
date设置时间 设置时间:-s参数 date -s "20190426 15:22:33" date查看时间差 (-d参数多用于脚本) 查看时间差:-d参数date -d &q ...
- stark - 4 ⇲ 视图函数
✘ list_view 处理表格(默认是显示表结构的所有字段) 1 list_display = self.get_list_display() # 4.1处理表头 header_list = [] ...
- PS2模拟器 PCSX2 新手向
1.模拟器的下载 1.1百度网盘地址:http://pan.baidu.com/s/1i3kt7bJ (已经整合了PS2BIOS的模拟器下载,比较新的版本,适合新手) 1.2高端玩家可以下载: 官网g ...
- js数字格式化为千分位
方法1: 浏览器自带的一个方法 const num=12345.6789 num.toLocaleString();=>"12,345.679" 方法2: 正则匹配 func ...
- 安装CentOS 7.4时服务器出现No Caching mode page found问题的解决方法
2019-03-27 前提准备条件: 操作系统:centos 7.4:服务器使用U盘安装,U盘使用UltraISO制作启动盘 安装过程出现的问题: [sdb] No Caching mode page ...
- spring boot快速入门 7: 使用aop处理请求
样例:登陆拦截(aop简单样例) 第一步:在pom 文件中加入aop依赖 <!-- spring aop --> <dependency> <groupId>org ...
- php7安装并apache
1.下载php7 选择THREAD SAFE版本,如果是64位系统要下载x64的,x86的不行 2.解压到想要安装的目录 3.apache配置 1) 添加PHP模块 查找“Dynamic Shared ...
- java处理数据库的CRUD
package com.lhy.jdbc.util; import java.sql.Connection; import java.sql.PreparedStatement; import jav ...