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

请问为什么WA

Posted by direfire at 2006-10-13 14:13:47 on Problem 1200
#include <iostream> 
#include <sstream> 
#include <string> 
#include <vector> 
#include <set> 
#include <map> 
#include <algorithm> 
#include <cstdio> 
#include <cstdlib> 
#include <cmath>
#include <math.h>
#include <string.h>
#include <stdlib.h>
using namespace std; 

#define REP(i, n) for(int i = 0; i<(n); i++) 
#define abs(a) ((a) >= 0 ? (a) : -(a)) 
#define inf 999999999 
typedef vector<int> VI; 
typedef vector<string> VS; 
typedef long long i64; 
typedef unsigned long long u64;


int n, nc;
char buf[1<<25];
bool v[1<<25]; 
int main()
{
	cin>>n>>nc;
	scanf("%s", buf);
	long long res = 0;
	for (int i = 0; buf[i+n-1] != '\0'; i++)
	{
		int t = 0;
		for (int j = i; j < i+n; j++)
			t = t*nc + buf[j] - 'a'; 
		if (v[t] == 0) {v[t] = 1; res++; }
	}
	printf("%I64d", res);			
}

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