首页 > Web开发 > 详细

2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String

时间:2016-08-14 15:59:19      阅读:384      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1011&cid=719

 

Sample Input
2
aabcc
acdeaa
 

Sample Output
Case #1: 3
Case #2: 4

 

***************************************************

题意:我只能说题意神马都是浮云,纯属干扰,直接看代码吧

 

 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<iostream>
 4 #include<algorithm>
 5 #include<math.h>
 6 using namespace std;
 7 #define N 1100
 8 
 9 char s[110000];
10 int v[27];
11 
12 int main()
13 {
14     int i,T,k=1,len;
15 
16     scanf("%d", &T);
17 
18     while(T--)
19     {
20         memset(v, 0, sizeof(v));
21         int ans=0;
22         scanf("%s",s);
23         len=strlen(s);
24 
25         for(i=0;i<len;i++)
26             v[s[i]-a]=1;
27 
28         for(i=0;i<27;i++)
29             if(v[i])
30             ans++;
31 
32       printf("Case #%d: %d\n", k++,ans);
33     }
34     return 0;
35 }

 

2016中国大学生程序设计竞赛 - 网络选拔赛 1011 Lweb and String

原文:http://www.cnblogs.com/weiyuan/p/5770254.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!