不高兴的津津

P1085 [NOIP2004 普及组] 不高兴的津津

...你看懂题目了吗
by 「已注销」 @ 2017-12-10 11:00:28


```cpp ####include<cstdio> ###int main() ###{ ###int i,t[8],a,b; ###for(i=1;i<=7;i++) ###{ ###scanf("%d%d",&a,&b); ###t[i]=a+b; ###} ###a=0,b=0; ###for(i=1;i<=7;i++) ###if(t[i]>8&&t[i]>a) ###a=t[i],b=i; ###printf("%d",b); ###return 0; ###}//这样就行了!!!###### ```
by 圣灵之光 @ 2017-12-10 11:01:58


```cpp #include<cstdio> int main() { int i,t[8],a,b; for(i=1;i<=7;i++) { scanf("%d%d",&a,&b); t[i]=a+b; } a=0,b=0; for(i=1;i<=7;i++) if(t[i]>8&&t[i]>a) a=t[i],b=i; printf("%d",b); return 0; } ```
by 圣灵之光 @ 2017-12-10 11:02:29


这人不会循环?
by 卑微的绝望 @ 2017-12-10 14:38:13


```cpp #include<stdio.h> int main(){ int a[7],b[7],n,j; j=1; for(n=1;n<=7;n++){ scanf("%d %d",&a[n],&b[n]); if(a[j]+b[j]-a[n]-b[n]<0){ j=n; } } printf("%d",j); return 0; } ```
by zhaige @ 2017-12-26 12:40:47


@[zhaige](/space/show?uid=74813) 为了符合题目 将 printf("%d",j); 改为 if(a[j]+b[j]>=8){ printf("%d",j); }
by zhaige @ 2017-12-26 18:01:44


```cpp #include<cstdio> #include<iostream> using namespace std; int main() { int a,b,c,d,e,f,g,max=9; int a1,a2,b1,b2,c1,c2,d1,d2,e1,e2,f1,f2,g1,g2; scanf("%d%d\n",&a1,&a2); scanf("%d%d\n",&b1,&b2); scanf("%d%d\n",&c1,&c2); scanf("%d%d\n",&d1,&d2); scanf("%d%d\n",&e1,&e2); scanf("%d%d\n",&f1,&f2); scanf("%d%d",&g1,&g2); a=a1+a2;b=b1+b2;c=c1+c2;d=d1+d2;e=e1+e2;f=f1+f2;g=g1+g2; if (a>=9) max=a; if (b>=9 && b>=max) max=b;if (c>=9 && c>=max) max=c; if (d>=9 && d>=max) max=d;if (e>=9 && e>=max) max=e; if (f>=9 && f>=max) max=f;if (g>=9 && g>=max) max=g; if (max==a) cout<<1; else {if (max==b) cout<<2; else {if (max==c) cout<<3; else {if (max==d) cout<<4; else {if (max==e) cout<<5; else {if (max==f) cout<<6; else {if (max==g) cout<<7; else cout<<0; } } } } } } } Sorry,有点长,But OK!O(∩_∩)O~ ```
by 海滨WA声 @ 2018-01-07 11:46:32


我发的是C++的
by 海滨WA声 @ 2018-01-07 11:47:13


@[ubsonth](/space/show?uid=74497) 看看我的类似的方法 scanf比cin快
by 海滨WA声 @ 2018-01-07 11:49:01


各种dalao秀题解
by 烈酒诱鹿 @ 2018-03-02 17:07:30


|