zoj 1851 Code Formatter 模拟
来源:互联网 发布:tensorflow中文版pdf 编辑:程序博客网 时间:2024/05/16 07:55
题目链接:http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=2851
题意:给出一段代码,统计‘\t'和后缀空格的个数,有一个地方要注意,后缀空格中出现'\t',要当4个空格算
#include <cstdio>#include <cstdlib>#include <cstring>char a[1000005];int main(){ //freopen("1.txt","r",stdin); int tab = 0, spa = 0, i, n = 0,ttab = 0, N, cas; scanf("%d", &N); fflush(stdin); for(cas = 0; cas < N; cas++) { tab = 0, spa = 0, n = 0,ttab = 0; while(true) { while(true) { a[n++]=getchar(); if(a[n-1]=='\n') break; } for(i = n - 2; i >= 0; i--) { if(a[i] != ' ' && a[i] != 9) break; if(a[i] == ' ') spa++; else ttab++; } for(i = 0; i < n - 1; i++) { if( a[i] == 9) tab++; } if(a[0] == '#' && a[1] == '#'&&a[2]=='\n') { printf("%d tab(s) replaced\n", tab); printf("%d trailing space(s) removed\n", spa+4*ttab); tab = spa = 0; memset(a, 0, sizeof(a)); n = 0; fflush(stdin); break; } memset(a, 0, sizeof(a)); n = 0; } } return 0;}
0 0
- zoj 1851 Code Formatter 模拟
- zoj 2851 Code Formatter
- zoj 2851 Code Formatter
- ZOJ 2851Code Formatter
- ZOJ 2851 Code Formatter
- 【ZOJ 2851 zoj 2851 Code Formatter】+ 字符串
- zoj 2851 Code Formatter 水题(1)
- Code Formatter
- Code Formatter
- code formatter
- ZOJ 2851 Code Formatter
- ZOJ-2851-Code Formatter【4th浙江省赛】
- ZOJ 3883Scan Code 模拟
- CCS4 eclipse code formatter
- z0j 2851 Code Formatter
- Android Studio Eclipse Code Formatter
- eclipse formatter.xml Code Templates
- eclipse code formatter 插件下载
- 第五周项目1(3)
- 为什么要有设计?
- JAVA 错误集合--源自技术
- 关于code,xib,storyboard的各自优劣
- 拯救纠结症 选iPhone SE还是iPhone6?
- zoj 1851 Code Formatter 模拟
- 个入侵检测程序来防止恶意刷新的功能
- 第六周【书面项目1】“IT妹子类”的设计UML
- 什么是算法的复杂度?
- Object-c 归档--源自技术
- install pycharm on Ubuntu
- UDID替代方案
- Maven入门(含实例教程)
- LeetCode 24. Swap Nodes in Pairs