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

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

ZCMU-1416-Find the Lost Sock

2019-11-11 01:19:40
字體:
來源:轉載
供稿:網友

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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 德庆县| 义马市| 琼海市| 丰都县| 高州市| 张家港市| 阿瓦提县| 宁明县| 荃湾区| 五大连池市| 贵州省| 恭城| 桐柏县| 汤阴县| 清镇市| 镇巴县| 开平市| 永胜县| 鄂州市| 淮滨县| 河北区| 衡水市| 巴彦淖尔市| 乌拉特前旗| 新营市| 浦城县| 晋城| 和平区| 弋阳县| 家居| 平度市| 连云港市| 南召县| 乾安县| 岱山县| 闸北区| 中卫市| 白银市| 安阳县| 上林县| 扎囊县|