poj1750.cpp

来自「本人最近在acm.pku.edu.cn上通过的程序」· C++ 代码 · 共 21 行

CPP
21
字号
#include <algorithm>
#include <string.h>
using namespace std;

char a[100], b[100];

int main(){
		int x = 0, y = 0, l1, l2, i;
		gets(b);  puts(b);
		while (gets(a) && a[0]){
			l1 = strlen(a);  l2 = strlen(b);
			for (i = 0; i < l1 && i < l2 && a[i] == b[i]; i++);
			if (i > y) x++; else x = i;
			y = x;
			for (i = 0; i < x; i++) putchar(' ');
			puts(a);
			strcpy(b, a);
		}
		return 0;	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?