PAT (Basic Level) Practice 1009 说反话 (20分) C语言
2020-07-26 11:41
549 查看
#include <stdio.h> #define IN 1 #define OUT 0 int main(int argc, char const *argv[]) { int c, state; char words[80][80]; int i = -1; int j = 0; state = OUT; while((c = getchar()) != EOF){ if(c == ' ' || c == '\n' ){ if(state == IN){//end state = OUT; if(c == ' '){ words[i][++j] = '\0'; j = 0; } else if ( c == '\n'){ words[i][++j] = '\0'; break; } } } else if (state == OUT){//begin state = IN; i++; words[i][j] = c; } else {//in j++; words[i][j] = c; } } int wc = i; for(i = wc; i >= 0; i--){ if(i == wc) { printf("%s", words[i]); }else printf(" %s", words[i]); } return 0; }
相关文章推荐
- PAT (Basic Level) Practice | 1009 说反话 (20分)
- Pat(Basic Level)Practice--1009(说反话)
- PAT (Basic Level) Practice 1009 说反话
- PAT(Basic level)Practice 1009 说反话 题解
- PAT (Basic Level) Practice (中文)1009 说反话
- 浙江大学PAT (Basic Level) Practice (中文)1009说反话JAVA实现代码及分析
- PAT (Basic Level) Practice 1009 说反话
- PAT (Basic Level) Practice (中文)1009 说反话
- PAT (Basic Level) Practice (中文)1056 组合数的和(C语言)
- PAT (Basic Level) Practice (中文)1063 计算谱半径(C语言)
- PAT (Basic Level)1009. 说反话
- PAT (Basic Level) Practise:1009. 说反话
- PAT (Basic Level) 1009 说反话
- PAT (Basic Level) Practice (中文)1075 链表元素分类(C语言)
- PAT (Basic Level) Practice | 1022 D进制的A+B (20分)
- PAT BASIC LEVEL 1009. 说反话 (20)
- 1018 锤子剪刀布 (20分) Java题解 PAT (Basic Level) Practice (中文)
- PAT (Basic Level) Practice (中文)1073 多选题常见计分法 (C语言)
- PAT (Basic Level) Practise (中文) 1009说反话 (20)
- 1029 旧键盘 (20分) Java题解 PAT (Basic Level) Practice (中文) - Java最简解法