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

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

ZCMU-1416-Find the Lost Sock

2019-11-10 22:30:38
字體:
來源:轉載
供稿:網友

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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 策勒县| 台江县| 民和| 沾益县| 荔浦县| 林州市| 阿拉善右旗| 宣威市| 上饶县| 丰宁| 深水埗区| 临高县| 台东县| 中山市| 宣化县| 无锡市| 福安市| 沁源县| 泰宁县| 内乡县| 嘉善县| 喀喇沁旗| 灵石县| 桓台县| 同江市| 龙里县| 巴东县| 丘北县| 朝阳县| 龙泉市| 醴陵市| 南漳县| 池州市| 海丰县| 凌海市| 青田县| 深水埗区| 定边县| 安图县| 吉安县| 东乌|