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

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

ZCMU-1416-Find the Lost Sock

2019-11-10 23:34:20
字體:
供稿:網(wǎng)友

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【解析】這道題我一直沒做出來..現(xiàn)在問了一下才知道了做法...果然自己太笨.言歸正傳其實(shí)這道題的意思就是給你襪子的名字,看哪個(gè)名字出現(xiàn)的次數(shù)是奇數(shù)次就是丟失的襪子,輸出這個(gè)名字就可以了。其實(shí)就是統(tǒng)計(jì)那個(gè)字符出現(xiàn)了奇數(shù)次,出現(xiàn)奇數(shù)次的字符我們就要輸出。因?yàn)橐m子總是成雙存在的。
#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]表示的是第幾位的字符出現(xiàn)次數(shù)            }        }        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;}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 闻喜县| 高州市| 乳山市| 都安| 二手房| 汝城县| 安宁市| 上高县| 郓城县| 宜宾市| 弥渡县| 仲巴县| 江川县| 仁寿县| 聊城市| 闸北区| 杭锦旗| 澄江县| 鸡东县| 卓尼县| 赤水市| 宿迁市| 类乌齐县| 如东县| 临泽县| 宁阳县| 叶城县| 平乐县| 博野县| 五莲县| 开平市| 高台县| 泰宁县| 兴业县| 汉川市| 汝南县| 大田县| 成安县| 新晃| 武胜县| 漯河市|