码迷,mamicode.com
首页 > 其他好文 > 详细

一个写得很shabi的differ

时间:2020-06-17 18:28:12      阅读:38      评论:0      收藏:0      [点我收藏+]

标签:algorithm   get   read   name   string   define   register   amp   lan   

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdlib>

#include <string>
#include <fstream>

using namespace std;

#define LL long long
#define R register

inline int read() {
	int x = 0, f = 1; char a = getchar();
	for(; a > ‘9‘ || a < ‘0‘; a = getchar()) if(a == ‘-‘) f = -1;
	for(; a >= ‘0‘ && a <= ‘9‘ ; a = getchar()) x = x * 10 + a - ‘0‘;
	return x * f;
}

int main() {
	system("g++ -o circle circle.cpp");
	int sum = 0, ms = 100 / 20;
	for(R int i = 1; i <= 20; i ++) {
		string s = "circle";
		if(i < 10) {
			s += char(i%10 + ‘0‘);
		}
		else {
			s += char(i / 10 + ‘0‘);
			s += char(i%10 + ‘0‘);
		}
		s += ".in";
		ifstream fin(s);
		ofstream fout("circle.in");
		string ts;
		while(fin >> ts) fout<< ts << endl;
		system("./circle");
		s = "circle";
		if(i < 10) {
			s += char(i%10 + ‘0‘);
		}
		else {
			s += char(i / 10 + ‘0‘);
			s += char(i%10 + ‘0‘);
		}
		s += ".out";
		ifstream fin1(s), fin2("circle.out");
		string s1, s2;
		int f = 1;
		while(fin1 >> s1) { fin2 >> s2; if(s1 != s2) {f = 0;break; }}
		if(f) 
		printf("\033[0;32;40m Case %d: Accept!\n", i), sum += ms;
		else printf("\033[0;31;40m Case %d: Warning!\n", i);
	}
	printf("Your mark : %d\n", sum);
}

一个写得很shabi的differ

标签:algorithm   get   read   name   string   define   register   amp   lan   

原文地址:https://www.cnblogs.com/HN-wrp/p/13153908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!