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

用C++编译的,过不了

Posted by anothing at 2014-10-25 08:41:00 on Problem 3844
#include<iostream>
using namespace std;
int dn[1000001];

int main()
{
	int c;
	int d,n;
	int num,i=0;
	int r;
	int zero;
	long long sum;

	cin>>c;
	while(c--)
	{
		
		cin>>d>>n;
		
		memset(dn,0,sizeof(dn));
		zero=0;
		sum=0;

		for(i=0;i<n;i++)
		{
			cin>>num;
			r=num%d;
			dn[zero]++;
			if(d-r+zero>=d)
			{
				sum+=dn[d-r+zero-d];
			}
			else
			{
				sum+=dn[d-r+zero];

			}
			if(zero<r)
			{
				zero=zero-r+d;
			}
			else
			{
				zero=zero-r;
			}
		}

		cout<<sum<<endl;	
	}
	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