#include<cstdio> char bm[(1<<23)]; main(){ bm[fread(bm,1,sizeof(bm),stdin)]=0; char*w=bm; while(*w>='0')w++;w++; int s=0,nnp=8192; register int t=0; while(*w){ if(*w<'0'){ s+=t; if(t&1)if(t<nnp)nnp=t; t=0;} else{t*=10;t+=*w-'0';} w++; } if(s&1)s-=nnp; printf(s?"%d\n":"NIESTETY\n",s); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<cstdio> char bm[(1<<23)]; main(){ bm[fread(bm,1,sizeof(bm),stdin)]=0; char*w=bm; while(*w>='0')w++;w++; int s=0,nnp=8192; register int t=0; while(*w){ if(*w<'0'){ s+=t; if(t&1)if(t<nnp)nnp=t; t=0;} else{t*=10;t+=*w-'0';} w++; } if(s&1)s-=nnp; printf(s?"%d\n":"NIESTETY\n",s); } |