ACM之路
詠生
这个作者很懒,什么都没留下…
展开
-
91.hdu--1283--最简单的计算机
#include#includeusing namespace std;int main(){ int n; while(cin>>n){ vector vec; for(int i=0;i<n;++i){ int temp;cin>>temp; vec.push_back(temp); } vector boom; int cut=0; for(a原创 2017-02-09 15:59:00 · 186 阅读 · 0 评论 -
90.hdu--1237--简单计算器
#include#include#include#includeusing namespace std;int main(){ double a; while(cin>>a) { char ch; if(a == 0){ if((ch=getchar())== '\n')break; }else getchar(); stack s; while(!s.原创 2017-02-09 15:58:14 · 265 阅读 · 0 评论 -
92.hdu--1870--愚人节的礼物
#include#include#includeusing namespace std;int main() { string str; while(getline(cin,str)){ stack s; for(char c:str){ if(!s.empty() &&s.top()=='(' && c==')') { s.pop();continue;原创 2017-02-09 16:00:24 · 246 阅读 · 0 评论 -
93.hdu--1873--看病要排队
#include#include#includestruct news{ int lev; int num; bool operator <(const news a)const{ return this->lev==a.lev?this->num>a.num:this->lev<a.lev; }};using namespace std;int main(){ int原创 2017-02-09 16:00:53 · 214 阅读 · 0 评论 -
94.hdu--2000--ASCII码排序
#include#includeusing namespace std;int main(){char str[4];while(cin>>str){sort(str,str+3);cout}return 0;}原创 2017-02-09 16:01:27 · 157 阅读 · 0 评论 -
95.hdu--2004--成绩转换
#include#includeusing namespace std;int main(){int score;while(cin>>score){if(scoreelse if(scoreelse if(scoreelse if(scoreelse if(scoreelse if(scoreelse puts("Score is error!原创 2017-02-09 16:01:53 · 185 阅读 · 0 评论 -
96.hdu--2010--水仙花数
#include using namespace std;int main(){ int m,n; while(cin>>m>>n){ int mark=0; for(int i=m;i<=n;++i){ int a=i%10; int b=(i/10)%10; int c=i/100; if(a*a*a+b*b*b+c*c*c==i){ if(!原创 2017-02-09 16:02:30 · 193 阅读 · 0 评论 -
97.hdu--2013--蟠桃记
#include using namespace std;int main(){ int n; while(cin>>n){ int sum=1; for(int i=1;i<n;++i){ sum=(sum+1)*2; } cout<<sum<<endl; } return 0;}原创 2017-02-09 16:03:00 · 164 阅读 · 0 评论 -
98.hdu--2022--海选女主角
#include #includeusing namespace std;int main(){ int m,n; while(cin>>m>>n){ int max=0,x; int a; for(int i=0;i<m*n;++i){ cin>>a; if(abs(max)<abs(a)){ max=a; x=i+1; } }原创 2017-02-09 16:03:29 · 314 阅读 · 0 评论 -
99.hdu--2031--进制转换
#include#includeusing namespace std;void tranToR(int,int);stack st;int main(){ int n,r; while(cin>>n>>r){ if(n<0){ n=0-n; cout<<"-"; } tranToR(n,r); while(!st.empty()){ cout<<原创 2017-02-09 16:04:19 · 190 阅读 · 0 评论 -
100.hdu--2041--超级楼梯
//#include Time Limit//using namespace std;//void dfs(int);//int count;//int main()//{// int n;// cin>>n;// while(n--){// int m;// count=0;// cin>>m;// dfs(m-1);// cout<<count<<endl;原创 2017-02-09 16:05:15 · 290 阅读 · 0 评论 -
101.hdu--2098--分拆素数和
#include#includeusing namespace std;vector table;void priTable();int primeNumber(int);int main(){ int n; priTable(); while(cin>>n && n!=0){ int count=0; for(vector::iterator it=table.beg原创 2017-02-10 18:39:05 · 262 阅读 · 0 评论 -
102.hdu--4148--Length of S(n)
#include#include#includevoid priTable();using namespace std;int arr[30];int main(){ int n; priTable(); while(cin>>n && n!=0){ cout<<arr[n-1]<<endl; } return 0;}void priTable(){ arr[0]原创 2017-02-10 18:39:50 · 252 阅读 · 0 评论 -
108.NYOJ--水池数目
//NYOJ--水池数目#include#includeconst int MAX_SIZE{102};using namespace std;void dfs(int,int);int map[MAX_SIZE][MAX_SIZE];int main(){ //freopen("input.txt","r",stdin); int N; cin>>N; while(N--)原创 2017-02-10 18:42:52 · 212 阅读 · 0 评论 -
73.The Famous Clock
#include#includeint main(){ char a[][5] = {"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"}; char b[5] = {0} ; int k = 0; while(scanf("%s",b) != EOF) { for(int i=0;i原创 2016-08-02 20:03:40 · 286 阅读 · 0 评论 -
75.对称排序
#include#includeint main(){ int N; int k = 1; while(scanf("%d",&N) && N) { getchar(); char a[100][30]; int i; for(i=0;i { scanf("%s",a[i]); } for(i=0;i {原创 2016-08-02 20:05:02 · 259 阅读 · 0 评论 -
77.A problem is easy
#include//改了太多int seach(int a){ int i; int counter = 0; for(i=1;(i+1)*(i+1) { if((a+1)%(i+1)==0 ) { counter++; } } printf("%d\n",counter); return 0;}int main(){原创 2016-08-02 20:09:57 · 338 阅读 · 0 评论 -
78.a letter and a number
#includeint addword(char ch,int a){ if(ch>='a') { ch -= 96; return a-ch; } else { ch -= 64; return ch+a; }}int main(){ int N; char ch; int a; scanf("%d",&N);原创 2016-08-02 20:10:58 · 207 阅读 · 0 评论 -
79.NYOJ--STL--求次数
#include#include#include using namespace std;int main(){ // freopen("input.txt","r",stdin);// freopen("output.txt","w",stdout);map::iterator it;int T;scanf("%d",&T);while(T--){in原创 2017-01-24 11:27:33 · 170 阅读 · 0 评论 -
80.NYOJ--STL--一种排序
#include#include#include#includeusing namespace std;struct rec{int n;int l;//longint w;//widthbool operator if(n>a.n){return 0;}else if(nreturn 1;}else {if(l>a.l){ret原创 2017-01-24 11:28:05 · 157 阅读 · 0 评论 -
string::npos,一个很大的数
string::npos,这是一个很大的数npos 是这样定义的:static const size_type npos = -1;因为 string::size_type (由字符串配置器 allocator 定义) 描述的是 size,故需为无符号整数型别。因为缺省配置器以型别 size_t 作为 size_type,于是 -1 被转换为无符号整数型别,npos 也就成了该原创 2017-01-24 11:31:01 · 228 阅读 · 0 评论 -
82.hdu--1257--最少拦截系统
#include#includeusing namespace std;int main(){ int n; while(cin>>n){ vector vec; for(int i=0;i<n;++i){ int temp;cin>>temp; vec.push_back(temp); } vector boom; int cut=0; for(a原创 2017-02-09 15:46:40 · 162 阅读 · 0 评论 -
83.hdu--2570--迷瘴
#include#include#includeusing namespace std;int main(){ int c; cin>>c; while(c--){ int n,v,w; cin>>n>>v>>w; vector vec; for(int i=0;i<n;++i){ int temp;cin>>temp; vec.push_back(t原创 2017-02-09 15:48:38 · 184 阅读 · 0 评论 -
84.hdu--1001--Sum Problem
#include using namespace std;int main(){ long long n;//计算过程中int不够用了 while(cin>>n) { cout<<n*(n+1)/2<<endl<<endl; } return 0;}原创 2017-02-09 15:51:15 · 195 阅读 · 0 评论 -
86.hdu--1022--Train Problem I
#include#include#includeusing namespace std;int main(){ int n; string o1,o2; while(cin>>n>>o2>>o1){ stack s; string str="1"; s.push(o2[0]); int i=0,j=0; while(i<n&&j<n) { if(s.s原创 2017-02-09 15:54:08 · 149 阅读 · 0 评论 -
87.hdu--1106--排序
#include#include#include#include#includeint translateNumber(char*);using namespace std;int main(){ char str[1009]; while(cin>>str) { vector arr; char *p=strtok(str,"5"); while(p != NU原创 2017-02-09 15:55:59 · 134 阅读 · 0 评论 -
88.hdu--1201--18岁生日
#include #includeint leapYear(const int);using namespace std;int main(){ int T; cin>>T; while(T--){ int year,month,day; int count=0; scanf("%d-%d-%d",&year,&month,&day); if(month==2&&d原创 2017-02-09 15:56:50 · 253 阅读 · 0 评论 -
89.hdu--1236--排名
#include #include#include#includeusing namespace std;struct message{ string name; int score; message():score(0){ }; bool operator<(const message b)const { return this->score==b.score?this-原创 2017-02-09 15:57:32 · 169 阅读 · 0 评论 -
85.hdu--1004--Let the Balloon Rise
#include#include#includeusing namespace std;int main(){ int N; while(cin>>N && N!=0) { string str; map bal; for(int i=0;i<N;++i){ cin>>str; bal[str]++; } map::iterator it=bal.b原创 2017-02-09 15:52:56 · 210 阅读 · 0 评论 -
56.谁是最好的Coder
#includeint main(){int N = 1;while(1){scanf("%d",&N);if(!N){break;}fflush(stdin);int mark = 0;while(N--){int a,b;scanf("%d %d",&a,&b);if(a+b >mark){mark = a+b;}原创 2016-07-30 09:42:01 · 207 阅读 · 0 评论 -
58.万圣节派对
#includeint same(int a){int i,j=10000;int mark = 0;for(i=0;i{if(j == a%10){mark++;}a /= 10;}return mark;}int dec(int a){int i,j;int mark = 0;j = a%10;for(i=0;i原创 2016-07-30 09:43:01 · 274 阅读 · 0 评论 -
62.画图
#includeint main(){int n;scanf("%d",&n);for(int i=0;i{for(int j=0;j{printf("*");}printf("\n");}return 0;}原创 2016-07-30 09:45:15 · 211 阅读 · 0 评论 -
63.取石子(七)
#includeint main(){int n;while(scanf("%d",&n)!=EOF){if(n>2){printf("Yougth\n");}else{printf("Hrdv\n");}}return 0;}原创 2016-07-30 09:45:44 · 254 阅读 · 0 评论 -
64.A+B Problem(V)
#includeint reoff(int a){int m;int fina = 0;while(a){m = a%10;fina *= 10;fina += m;a /= 10;}return fina;}int main(){int n,m;scanf("%d %d",&m,&n);while(n || m){p原创 2016-07-30 09:46:24 · 212 阅读 · 0 评论 -
65.无主之地1
#include#includeint main(){int a[100] = {0};int b[100] = {0};int m,n;int i = 0;memset(a,0,100);memset(b,0,100);do{scanf("%d %d",&m,&n);if(a[m] == 0){a[m] += n;b[i++] =原创 2016-07-30 09:47:00 · 317 阅读 · 0 评论 -
66.关于521
#include int crazy = 0;int crazy_num = 0;int vcrazy = 0;void seach(int number){ int a[9]; int i; int b[3]={0}; int mark = 0; for (i=0; number; i++) {原创 2016-07-30 09:47:35 · 307 阅读 · 0 评论 -
67.不可以!
#include#include#includeint main(){int a,b;while(scanf("%d %d",&a,&b)!=EOF){if(!a || !b){printf("Signs can't be sure\n");}else if(a-abs(a) && b-abs(b)){printf("Signs are no原创 2016-07-30 09:48:13 · 244 阅读 · 0 评论 -
68.数字分隔(二)
#include #include #include #include void initArr(char *arr,int n){int i = 0;while (i++{ arr[i]=0; }}int main(){ char array[102]={0}; char array_1[150]={0};原创 2016-07-30 09:49:30 · 332 阅读 · 0 评论 -
72.Financial Management
#includeint main(){ float a; int i = 0; float num = 0; do { scanf("%f",&a); num += a; }while(i++ printf("%g\n",num/12); return 0;}原创 2016-08-02 20:03:25 · 246 阅读 · 0 评论 -
71.Coin Test
#includeint huajian(int a,int b){ int n; while(a%b) { int k; k = a%b; a = b; b = k; } return b;}int main(){ int N; while(scanf("%d",&N) !=EOF) { getchar();原创 2016-08-02 20:03:07 · 196 阅读 · 0 评论