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

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

hdu 1029 Ignatius and the Princess IV

2019-11-06 06:34:06
字體:
來源:轉載
供稿:網友

我的想法,第一個想到是用stl的map,然后想到的是排序,中間的數字就是結果。

#include <cstdio>#include <algorithm>using namespace std;int num[1000000];int main(){ int n; while(scanf("%d",&n) != EOF) { for(int i = 0;i < n; ++i) scanf("%d",&num[i]); sort(num,num+n); 我又搜了一下別人的題解,發現新大陸—>同等消除 http://www.cnblogs.com/kuangbin/archive/2011/07/30/2122217.html

#include <cstdio>int main(){ int res,cnt,n,num; while(scanf("%d",&n) != EOF) { cnt = 0; for(int i = 0; i < n; ++i) { scanf("%d",&num); if(cnt == 0) { res = num; cnt++; } else { if(res == num) ++cnt; else --cnt; } } printf("%d/n",res); } return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 长沙县| 松桃| 罗山县| 元氏县| 德昌县| 康马县| 微博| 珲春市| 屯留县| 闽清县| 淮阳县| 昭通市| 青铜峡市| 湘阴县| 沙坪坝区| 九江市| 吉水县| 望奎县| 清水河县| 汉寿县| 梅州市| 兴城市| 绥宁县| 军事| 柳州市| 孟村| 海安县| 阿巴嘎旗| 吴忠市| 横山县| 文水县| 高邮市| 慈利县| 徐闻县| 赣州市| 太谷县| 正阳县| 互助| 曲阜市| 玛多县| 平顶山市|