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 ...
随机推荐
- C语言 从头学起了
1,我用的是VC6.0++编译器 具体安装使用教程 去网上找 2,刚写hello world时候 就遇到一个坑. #网上 hello world 代码 #include<stdio.h> ...
- lucene索引的更新和删除
索引的删除: IndexReader和IndexWriter都由删除索引的功能,但这两者是有区别的, 使用IndexReader删除索引时,索引会马上被删除,其有两种方法,可以删除索引deleteDo ...
- Flutter 1.0 正式版: Google 的便携 UI 工具包
简评:所以 React-Native 和 Flutter 该怎么选? 在 10 个月前的 MWC 上,谷歌发布了 Flutter 的 Beta 版本,给跨平台应用开发带来了一种全新的选择,昨天谷歌正式 ...
- 空行会影响 Java 编译吗?
简评:往往越简单的问题越容易被人们忽略. 问题 这个月的 Stack Overflow 有篇热门文章是国外有位开发者提出: 当我仅仅对 Java 类增加了一行空行,为什么编译后得到了两个不同的字节码文 ...
- C++多线程编程二
1. 死锁与解锁: #include <iostream> #include <thread> #include <mutex> using namespace s ...
- 2016级算法第六次上机-D.AlvinZH的学霸养成记V
1081 AlvinZH的学霸养成记V 思路 中等题,计算几何. 这是一个排序问题,按极角排序.可以转化为叉积的应用,对于点A和B,通过叉积可以判断角度大小,共线时再判断距离. 叉积的应用.OA × ...
- asp.net图片上传代码
前端: <form action="/ImageUpload.ashx" method="post" enctype="multipart/fo ...
- 南昌 Max answer
https://nanti.jisuanke.com/t/38228 Alice has a magic array. She suggests that the value of a interva ...
- /usr/bin/ld: cannot find -lperconaserverclient_r 解决
编译sqladvisor安装遇到: [root@localhost sqladvisor]# cd SQLAdvisor/sqladvisor/ [root@localhost sqladvisor] ...
- 二分难题 && deque
141. Sqrt(x) https://www.lintcode.com/problem/sqrtx/description?_from=ladder&&fromId=4 publi ...