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 ...
随机推荐
- java使用Redis7--分布式存储并实现sentinel主从自动切换
前面实现了分布式存储,也实现了sentinel单点故障时主从自动切换,现在还需要一种机制,实现分布式存储下,单点故障时的主从自动切换. Server配置 # cd /usr/redis/src/tes ...
- Web Worker 使用教程(转)
转自:http://www.ruanyifeng.com/blog/2018/07/web-worker.html 一.概述 JavaScript 语言采用的是单线程模型,也就是说,所有任务只能在一个 ...
- leetcode 198 打家劫舍 Python 动态规划
打家劫舍 你是一个专业的小偷,计划偷窃沿街的房屋.每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警. 给定 ...
- leetcode-268-Missing Number(异或)
题目描述: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is ...
- 架构师养成记--26.vi/vim相关操作
vi/vim命令模式插入模式 aio编辑模式 : aio就是vi/vim的插入模式命令 作用a 在光标后附加文本A 在本行末附加文本i 在光标钱插 ...
- MySQL与Redis实现二级缓存
redis简介 Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库 Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久化, ...
- 关于开发环境无法运行applet
测试一下IE java vm 如果没有正确显示出来,说明java vm插件没有装好: 我用Uninstalle 来清理注册表:重装jdk 1.6_45
- Highcharts图表.net版开源,支持webform 和 mvc3,完全开源
Highcharts是一个制作图表的纯Javascript类库,主要特性如下: 兼容性:兼容当今所有的浏览器,包括iPhone.IE和火狐等等: 对个人用户完全免费: 纯JS,无BS: 支持大部分的图 ...
- C# 文件操作系列一
在.Net环境中,所有关于文件操作的类都在System.IO命名空间下,注:在修改文件时,安全性显得格外重要,但是本随笔不过多讲述安全性,这里假设我们有足够的权限. 1.管理文件系统 先通过一幅图来了 ...
- HUE配置文件hue.ini 的Spark模块详解(图文详解)(分HA集群和HA集群)
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...