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 temp_ptr at 2011-12-09 01:22:24 on Problem 2321
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int N = 10;
double data[N][N], p[N][N], curr[N], next[N];
int n;
string str;
void findN()
{
	n = 0;
	double x = 0.0;
	int len = str.size();
	for(int i = 0; i < len; i++)
	{
		if(str[i] == ' ')
			data[0][n++] = x, x = 0.0;
		else
			x = (x*10 + (str[i] - '0'));
	}
	data[0][n++] = x;
}
int main()
{
        while(getline(cin, str))
	{
		if(str.size() == 0) continue;
		findN();
		for(int i = 1; i < n; i++)
			for(int j = 0; j < n; j++)
				cin>>data[i][j];

		//your code here		
	}
	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