十大购物网站,合肥工业设计公司,最新wordpress程序,北京 网络发布【题目描述】 传送门 【题目分析】 今天开始刷紫书的题目啦
这道题很简单#xff0c;需要注意的是cgetchar()需要加上括号#xff0c;因为赋值语句的优先级比判等低
而且书中说好像最好用整型变量#xff0c;因为EOF的值为-1#xff0c;在字符变量中没有这个值。#xf…【题目描述】 传送门 【题目分析】 今天开始刷紫书的题目啦
这道题很简单需要注意的是cgetchar()需要加上括号因为赋值语句的优先级比判等低
而且书中说好像最好用整型变量因为EOF的值为-1在字符变量中没有这个值。但是我自己写了一个测试了一下好像也没有什么问题
【AC代码】
#includecstdio
#includecstring
#includecstdlib
#includealgorithm
#includeiostream
#includecmath
#includeclimits
#includequeue
#includevector
#includeset
#includemap
using namespace std;typedef long long ll;
const int INF0x3f3f3f3f;
const int MAXN10;int main()
{int c,p0;while((cgetchar())!EOF){if(c){if(p%20){printf();}else{printf();}p;}else{printf(%c,c);}}return 0;
}#includecstdio
#includecstring
#includecmath
#includealgorithm
#includequeue
#includecstdlib
#includeset
#includemap
#includevectorusing namespace std;typedef long long ll;
const int INF0x3f3f3f3f;
const int MAXN1e55;int main()
{
// freopen(data.in,r,stdin);
// freopen(data_test.out,w,stdout);char c;bool ptrue;while((cgetchar())!EOF){if(c){printf(%s,p?:);p!p;}else{printf(%c,c);}}return 0;
}