Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

竟如此简单

Posted by ly50247 at 2009-04-18 21:50:39 on Problem 2572
#include <iostream>
#include <cstring>

using namespace std;
char data[30];
int main()
{
	while (true)
	{
		cin >> data;
		if (strcmp(data, "0+0=0") == 0)
		{
			cout << "True\n";
			break;
		}
		int len = strlen(data);
		for (int i = 0; i < len / 2; i++)
		{
			int t = data[i];
			data[i] = data[len-i-1];
			data[len-i-1] = t;
		}
		
		int a, b, c;
		sscanf(data, "%d=%d+%d", &a, &b, &c);
		if (a == b+c)
			cout << "True\n";
		else
			cout << "False\n";
	}
	
	
	
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator