Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么一直RT啊。。郁闷啊,大牛帮看看还有哪里能引起RT#include <stdio.h> #include <string.h> #include <algorithm> #include <sstream> #include <iostream> using namespace std; char s[10000][101]; char str[10001]; char str1[101]; char str2[101]; int n; int num(){ int i , temp = 0 , num = 0; for(i = 0 ; i < n; i++){ if(strcmp(s[i],str1) == 0){ temp = 1; num++; } else if(strcmp(s[i],str1)!= 0 && temp ==1) return num; } return num; } int main() { int o , i , m , t = 0 ,ans; scanf("%d",&o); while(o--){ ans = 1; printf("Scenario #%d:\n",++t); scanf("%d",&n); for(i = 0; i < n ; i ++){ scanf("%s",str2); sort(str2 + 1, str2 + strlen(str2) - 1); strcpy(s[i] , str2); } scanf("%d",&m); getchar(); for(i = 0 ; i < m ; i++){ gets(str); ans = 1; istringstream str3(str); while(str3 >> str1){ sort(str1+1 , str1 +strlen(str1) - 1); ans *= num(); } printf("%d\n",ans); } printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator