⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1029 ignatius and the princess iv.cpp

📁 威士忌的HDU题解.大概有260多题的源码。对于学习非常有好处。
💻 CPP
字号:
/*
1029 Ignatius and the Princess IV
Time Limit : 1000 ms  Memory Limit : 1024 K  Output Limit : 1024 K

375 MS 332 KB 748 B 
GUN C++
*/
#include <iostream.h>
#include <stdio.h>
#include <string.h>
using namespace std;

const int NMAX=999999;

int main()
{
    int n,times,now,ca;
    int num[10000]={0};
    while(scanf("%d",&n)==1)
    {
        if(n%2==0)
            break;
        times=(n+1)/2;
        for(ca=0;ca<n;ca++)
        {
            scanf("%d",&now);
            num[now]++;
            if(num[now]>=times)
            {
                printf("%d\n",now);
				ca++;
                break;
            }
        }
		for(;ca<n;ca++)
		{	scanf("%*d");}
        memset(num, 0, sizeof(num));
    }
    return 0;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -