随笔分类 -  关于输入和输出

摘要:1 inline int read() 2 { 3 int x=0,w=1;char ch=0; 4 while(!isdigit(ch)){if(ch=='-') w=-1;ch=getchar();} 5 while(isdigit(ch)) x=(x<<3)+(x<<1)+ch-'0',ch=getchar(); 6 return x*w; 7 } 8 int buf[30]; 9 void 阅读全文
posted @ 2019-10-19 21:11 月亮茶 阅读(206) 评论(0) 推荐(0)
摘要:1.读取char[] 1 char s[1000000]; 2 int l; 3 1. 4 scanf("%[^\n]",s); 5 /*说明:在scanf函数中,可以使用%c来读取一个字符,使用%s读取一个字符串, 6 但是读取字符串时不忽略空格,读字符串时忽略开始的空格, 7 并且读到空格为止, 阅读全文
posted @ 2019-10-12 15:19 月亮茶 阅读(1027) 评论(0) 推荐(0)
摘要:输入包含多组数据 while(~scanf("%d",&n))<=> while(scanf("%d",&n)!=EOF) 阅读全文
posted @ 2019-10-12 13:12 月亮茶 阅读(149) 评论(0) 推荐(0)