国产探花免费观看_亚洲丰满少妇自慰呻吟_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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 潢川县| 雷州市| 洛宁县| 明光市| 丹东市| 常山县| 沐川县| 井陉县| 德州市| 渭源县| 平昌县| 尼木县| 通海县| 溆浦县| 友谊县| 呼伦贝尔市| 平阴县| 仪征市| 抚宁县| 恩平市| 辽宁省| 英德市| 永清县| 长垣县| 陆良县| 阿合奇县| 彭山县| 岚皋县| 二手房| 栾城县| 庐江县| 余姚市| 鄯善县| 阿克陶县| 雅江县| 同江市| 德阳市| 昌吉市| 安图县| 明溪县| 丰镇市|