Where Amazing Happens(打表)

一道大水题,但是怎么说,还是学会了打表。哈哈哈

打表程序

#include<cstdio>
#include<iostream>

char str[55000][100];

int main() {
    freopen("heh.txt","r",stdin);
    freopen("hah.txt","w",stdout);
    int i = 0;
    while(gets(str[i])) i++;
    for(int k = 0;k < i;k++) {
        printf("strcpy(str[%d],\"",k); 
        for(int j = 8;str[k][j] != '\0';j++) { //像"这种符号要在前面加\
            printf("%c",str[k][j]);
        }
        printf("\");\n");
    }
}


主程序

#include<cstdio>
#include<cstring>

char str[10000][100];

int main() {
strcpy(str[0],"Cleveland Cavaliers");
strcpy(str[1],"Golden State Warriors");
strcpy(str[2],"San Antonio Spurs");
strcpy(str[3],"Miami Heat");
strcpy(str[4],"Miami Heat");
strcpy(str[5],"Dallas Mavericks");
strcpy(str[6],"L.A. Lakers");
strcpy(str[7],"L.A. Lakers");
strcpy(str[8],"Boston Celtics");
strcpy(str[9],"San Antonio Spurs");
strcpy(str[10],"Miami Heat");
strcpy(str[11],"San Antonio Spurs");
strcpy(str[12],"Detroit Pistons");
strcpy(str[13],"San Antonio Spurs");
strcpy(str[14],"L.A. Lakers");
strcpy(str[15],"L.A. Lakers");
strcpy(str[16],"L.A. Lakers");
strcpy(str[17],"San Antonio Spurs");
strcpy(str[18],"Chicago Bulls");
strcpy(str[19],"Chicago Bulls");
strcpy(str[20],"Chicago Bulls");
strcpy(str[21],"Houston Rockets");
strcpy(str[22],"Houston Rockets");
strcpy(str[23],"Chicago Bulls");
strcpy(str[24],"Chicago Bulls");
strcpy(str[25],"Chicago Bulls");
strcpy(str[26],"Detroit Pistons");
strcpy(str[27],"Detroit Pistons");
strcpy(str[28],"L.A. Lakers");
strcpy(str[29],"L.A. Lakers");
strcpy(str[30],"Boston Celtics");
strcpy(str[31],"L.A. Lakers");
strcpy(str[32],"Boston Celtics");
strcpy(str[33],"Philadelphia 76ers");
strcpy(str[34],"L.A. Lakers");
strcpy(str[35],"Boston Celtics");
strcpy(str[36],"L.A. Lakers");
strcpy(str[37],"Seattle Sonics");
strcpy(str[38],"Washington Bullets");
strcpy(str[39],"Portland Trail Blazers");
strcpy(str[40],"Boston Celtics");
strcpy(str[41],"Golden State Warriors");
strcpy(str[42],"Boston Celtics");
strcpy(str[43],"New York Knicks");
strcpy(str[44],"L.A. Lakers");
strcpy(str[45],"Milwaukee Bucks");
strcpy(str[46],"New York Knicks");
strcpy(str[47],"Boston Celtics");
strcpy(str[48],"Boston Celtics");
strcpy(str[49],"Philadelphia 76ers");
strcpy(str[50],"Boston Celtics");
strcpy(str[51],"Boston Celtics");
strcpy(str[52],"Boston Celtics");
strcpy(str[53],"Boston Celtics");
strcpy(str[54],"Boston Celtics");
strcpy(str[55],"Boston Celtics");
strcpy(str[56],"Boston Celtics");
strcpy(str[57],"Boston Celtics");
strcpy(str[58],"St. Louis Hawks");
strcpy(str[59],"Boston Celtics");
strcpy(str[60],"Philadelphia Warriors");
strcpy(str[61],"Syracuse Nats");
strcpy(str[62],"Minneapolis Lakers");
strcpy(str[63],"Minneapolis Lakers");
strcpy(str[64],"Minneapolis Lakers");
strcpy(str[65],"Rochester Royals");
strcpy(str[66],"Minneapolis Lakers");
strcpy(str[67],"Minneapolis Lakers");
strcpy(str[68],"Baltimore Bullets");
strcpy(str[69],"Philadelphia Warriors");
    int t;
    scanf("%d",&t);
    getchar();
    char str1[100];
    for(int k = 1;k <= t;k++) {
        gets(str1);
        int ans = 0;
        for(int i = 0;i <= 69;i++)
            if(strcmp(str1,str[i]) == 0)
                ans++;
        printf("Case #%d: %d\n",k,ans);
    }
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值