国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ZCMU-1416-Find the Lost Sock

2019-11-10 23:24:25
字體:
來源:轉載
供稿:網友

1416: Find the Lost Sock

Time Limit: 2 Sec  Memory Limit: 128 MBSubmit: 311  Solved: 65[Submit][Status][Web Board]

Description

Alice bought a lot of pairs of socks yesterday. But when she went home, she found that she has lost one of them. Each sock has a name which contains exactly 7 charaters.

Alice wants to know which sock she has lost. Maybe you can help her.

Input

There are multiple cases. The first line containing an integer n (1 <= n <= 1000000) indicates that Alice bought n pairs of socks. For the following 2*n-1 lines, each line  is a string with 7 charaters indicating the name of the socks that Alice took back.

Output

The name of the lost sock.

Sample Input

2aabcdefbzyxwvubzyxwvu4aqwertyeasafghaqwertyeasdfgheasdfghaqwertyaqwerty20x0abcd0ABCDEF0x0abcd

Sample Output

aabcdefeasafgh0ABCDEF【解析】這道題我一直沒做出來..現在問了一下才知道了做法...果然自己太笨.言歸正傳其實這道題的意思就是給你襪子的名字,看哪個名字出現的次數是奇數次就是丟失的襪子,輸出這個名字就可以了。其實就是統計那個字符出現了奇數次,出現奇數次的字符我們就要輸出。因為襪子總是成雙存在的。
#include<iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int a[8][156];int main(){    int n,i,j;    char s[8];    while(~scanf("%d",&n))    {        memset(a,0,sizeof(a));        for(i=0;i<(2*n)-1;i++)        {            scanf("%s",s);            for(j=0;j<7;j++)            {                a[j][s[j]]++;//j代表第幾位,a[i][j]表示的是第幾位的字符出現次數            }        }        for(i=0;i<7;i++)        {            for(j=0;j<156;j++)            {                if(a[i][j]%2==1)//遍歷輸出就可以了                {                    PRintf("%c",j);                   break;                }            }        }        printf("/n");    }    return 0;}
上一篇:2.7小記

下一篇:1032. Sharing 解析

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 中方县| 南开区| 镇原县| 罗平县| 夏津县| 运城市| 平昌县| 吉首市| 天津市| 苏尼特右旗| 景德镇市| 巴彦淖尔市| 监利县| 二连浩特市| 彝良县| 铜梁县| 石城县| 晋中市| 皋兰县| 万盛区| 板桥市| 木兰县| 顺义区| 茌平县| 五台县| 连城县| 汕尾市| 石渠县| 肥城市| 小金县| 怀柔区| 北票市| 分宜县| 如东县| 南靖县| 中牟县| 平邑县| 遂平县| 南澳县| 桂东县| 兰坪|