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

Re:WA-> AC

Posted by spracle_hao at 2008-08-26 15:56:04 on Problem 1496
In Reply To:WA-> AC Posted by:spracle_hao at 2008-08-26 15:38:48
通过1850,排除了文件结束符的原因,那这又是什么原因呢?c++,g++???
附代码:

/*
Filename:  1496.cpp
Author: spracle
Created:  2008年08月26日 15时11分05秒
*/

#include<iostream>
#define min(a,b) ((a)>(b) ? (b) : (a))
using namespace std;

const int stdd[11]={0,26,325,2600,14950,65780,230230,657800,1562275,3124550,5311735};

int solve(int m,int n)
{
	if(m==n) return 1;
	if(m>n) return 0;
	m=min(m,n-m);
	double res=1.0;
	for(int i=1;i<=m;i++)
		res*=(n+1-i)*1.0/i;

	return (int)res;
}


int main()
{
	     char s[12];
             while(cin>>s)
             {
		int ps[12];bool flag=0;
		int l=strlen(s);
		for(int i=0;i<l;i++)
		{
			ps[i]=s[i]-'a'+1;
			if(i>=1 && s[i]<=s[i-1])
				flag=1;
		}
		if(flag) cout<<'0'<<endl;
		else
		{
			int res=0;
			for(int i=1;i<=l;i++)
				res+=stdd[i];
			for(int j=0;j<l;j++)
				res-=solve(l-j,26-ps[j]);
			cout<<res<<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