ing

#include <stdio.h>

int main(){

int a,b;

while(scanf("%d%d",&a,&b)!=EOF && !(a==0&&b==0))

printf("%d\n",a+b);

}

---------------------------------------分隔符-------------------------------------------------------------------

while(~scanf("%d%d",&m,&n))等同于while (scanf("%d%d",&m,&n)!=EOF)

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>
int main(){
int n,i,j,sum ;
while(1){
scanf("%d",&n);
if(n!=0){
sum = 0;
for(i = 0;i<n;i++){
scanf("%d",&j);
sum+=j;
}
printf("%d\n",sum);
}
else{
break;}
}
}//1902

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

int main(){
int n,i,j,sum,m ;
scanf("%d",&m);
while(m--){
scanf("%d",&n);
if(n!=0){
sum = 0;
for(i = 0;i<n;i++){
scanf("%d",&j);
sum+=j;
}
printf("%d\n",sum);
}
else{
break;}
}
}//1903

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

int main(){

while(scanf("%d")!= EOF){

int i=0,j=0,sum=0,first;

scanf("%d",&first);

for(i = 0;i<first;i++){

scanf("%d",&j);

sum += j;

}

printf("%d\n",sum);

}

}

4

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

int main(){

while(scanf("%d")!=EOF){

int i,j,sum,first;

scanf("%d",&first);

for(i =0;i< first;i++){

scanf("%d",&j);

sum+=j;}

printf("%d",sum);

}

}

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

int main(){

int i,j,sum=0,first;int flag=0;

while(scanf("%d",&first)!=EOF){

sum=0;

for(i =0;i< first;i++){

scanf("%d",&j);

sum+=j;}//仅之间有空格 第一个无设标记位,后每个前面都有

if(flag==1)printf("n");

else flag=1;

printf("%d\n",sum);

}

}

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

#define maxsize 32575

typedef int SElemType;

typedef struct stack{

SElemType *base,*top;

int stacksize;

}stack;

int Initstack(stack &S){  &s  S    *S  &S 

S.base = new SElemType[maxsize];

if(!S.base)

return -1;

S.base = S.top;

S.stacksize = maxsize;

return 0;

}

int push(stack &S,SElemType e){

if(S.top -S.base == S.stacksize)

return -1;

*(S.top++) = e;

return e;

}

int pop(stack &S,SElemType &e){

if(S.top == S.base)

return -1;

e = *--S.top;

return 1;

}

int stackEmpty(stack S){

if(S.base == S.top)

return -1;

return 0;

}

//十进制转换为八进制

int main(int a){

stack S;

SElemType e;

Initstack(S);

stackEmpty(S);

scanf("%d",&a);

while(a){

push(S,a%8);

a = a/8;

}

while(!stackEmpty(S)){

pop(S,e);

printf("%d",e);

}

return 0;

}

---------------------------------------分隔符-------------------------------------------------------------------

#include <stdio.h>

int main(){

int i,j,sum=0,first;int flag=0;

while(scanf("%d",&first)!=EOF){

sum=0;

for(i = 0;i<first;i++){

scanf("%d",&j);

sum += j;

}

printf("%d\n",sum);

}

}

//1094

上一篇:jquery统计页面的pv/ip及停留时间等


下一篇:HBASE学习笔记--概述