522 条题解
-
0
BeNoble LV 8 @ 2016-10-26 21:54:19
#include<iostream> using namespace std; int main() { int a,b,e,i,max=0,m[1000]={0},n,x,money=0;string s,name;char c,d; cin>>n; for(i=1;i<=n;i++) { cin>>name>>a>>b>>c>>d>>e; if(a>80&&e>0) m[i]+=8000; if(a>85&&b>80) m[i]+=4000; if(a>90) m[i]+=2000; if(d=='Y'&&a>85) m[i]+=1000; if(c=='Y'&&b>80) m[i]+=850; if(m[i]>max) s=name,max=m[i]; } for(i=1;i<=n;i++) money+=m[i]; cout<<s<<endl<<max<<endl<<money; return 0; }
-
0@ 2016-10-23 22:27:58
#include<iostream> #include<cstdio> using namespace std; struct node{ char name[25],ganb,xib; int qimo,banp,art,score; }man[105]; int n; int main(){ int i,ans=0,sum=0,res; scanf("%d",&n); for(i=1;i<=n;i++){ man[i].score=0; } for(i=1;i<=n;i++){ cin>>man[i].name>>man[i].qimo>>man[i].banp>>man[i].ganb; cin>>man[i].xib>>man[i].art; } for(i=1;i<=n;i++){ if(man[i].qimo>80&&man[i].art>=1){ man[i].score+=8000; } if(man[i].qimo>85&&man[i].banp>80){ man[i].score+=4000; } if(man[i].qimo>90){ man[i].score+=2000; } if(man[i].qimo>85&&man[i].xib=='Y'){ man[i].score+=1000; } if(man[i].banp>80&&man[i].ganb=='Y'){ man[i].score+=850; } } for(i=1;i<=n;i++){ if(man[i].score>ans){ ans=man[i].score; res=i; } sum+=man[i].score; } cout<<man[res].name<<endl<<ans<<endl<<sum<<endl; return 0; } -
0@ 2016-10-20 20:20:35
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<ctime>
#include<cstring>
#include<cassert>
#include<bitset>
#include<sstream>
#include<queue>
using namespace std;
struct xs
{
string name;
int cj;
int py;
char bgb;
char xb;
int lw;
int jxj;
};int main()
{
int rs,i,j;
cin>>rs;
xs a[rs];
for(i=0;i<rs;i++)
{
cin>>a[i].name;
cin>>a[i].cj;
cin>>a[i].py;
cin>>a[i].bgb;
cin>>a[i].xb;
cin>>a[i].lw;
a[i].jxj=0;
}
for(i=0;i<rs;i++)
{
if(a[i].cj>80 && a[i].lw>=1) a[i].jxj+=8000;
if(a[i].cj>85 && a[i].py>80) a[i].jxj+=4000;
if(a[i].cj>90) a[i].jxj+=2000;
if(a[i].xb=='Y' && a[i].cj>85) a[i].jxj+=1000;
if(a[i].py>80 && a[i].bgb=='Y') a[i].jxj+=850;
// cout<<a[i].jxj<<endl;
}
int sum=0;
string na;
int mx;
mx=-1;
for(i=0;i<rs;i++)
{
sum+=a[i].jxj;
if(a[i].jxj>mx)
{
na=a[i].name;
mx=a[i].jxj;
}
}
cout<<na<<endl<<mx<<endl<<sum;
return 0;
} -
0@ 2016-10-15 21:32:23
/*
2016年10月15日21:03:45
谁拿了最多奖学金
https://vijos.org/p/1001
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;struct student
{
char name[10];
int score;
int pingyi;
char leader;
char west;
int paper;
};
int main()
{
freopen("p1001.in", "r", stdin);
int num;
cin >> num;//学生个数
int ans[num+1];//奖学金
struct student stu[num+1];//学生
memset(ans, 0, sizeof(ans));//初始化奖学金为零for(int i=1;i<=num;i++)//读入学生信息
{
cin >> stu[i].name;
cin >> stu[i].score;
cin >> stu[i].pingyi;
cin >> stu[i].leader;
cin >> stu[i].west;
cin >> stu[i].paper;}
for(int j=1;j<=num;j++)
{
if(stu[j].score > 80 && stu[j].paper >=1)
ans[j] += 8000;
if(stu[j].score > 85 && stu[j].pingyi > 80)
ans[j] += 4000;
if(stu[j].score > 90)
ans[j] += 2000;
if(stu[j].west == 'Y' && stu[j].score > 85)
ans[j] += 1000;
if(stu[j].pingyi > 80 && stu[j].leader == 'Y')
ans[j] += 850;
}
int max = 0;//记录最大值
int flag;//记录第几个学生最大
for(int i=1;i<=num;i++)
{
if(ans[i] > max)
{
max = ans[i];
flag = i;
}
}
int total=0;//记录N个学生奖学金总数
for(int j=1;j<=num;j++)
total += ans[j];cout << stu[flag].name << endl;
cout << max << endl;
cout << total << endl;/* for(int i=1;i<=num;i++)
{
cout << stu[i].name << endl;
cout << stu[i].score << endl;
cout << stu[i].pingyi << endl;
cout << stu[i].leader << endl;
cout << stu[i].west << endl;
cout << stu[i].paper << endl;
}
*/return 0;
} -
0@ 2016-10-14 11:46:28
#include<iostream> #include<cstring> #include<algorithm> #include<string> using namespace std; int tot=0,n; struct NodeT{ string name; int qm,bp,lwn,reward; char xg,xs; }node[105];//结构体node存数据 /*bool comp(NodeT x,NodeT y){ if(x.reward!=y.reward)return x.reward>y.reward; return x.name<y.name; }比较函数 (不需要)delete */ void solve(){ for(int i=1;i<=n;i++){ node[i].reward=0; if(node[i].qm>80&&node[i].lwn>=1)node[i].reward+=8000; if(node[i].qm>85&&node[i].bp>80)node[i].reward+=4000; if(node[i].qm>90)node[i].reward+=2000; if(node[i].qm>85&&node[i].xs=='Y')node[i].reward+=1000; if(node[i].bp>80&&node[i].xg=='Y')node[i].reward+=850; }//逐个输入 node[0].reward=0;//***初始化为零*** 打擂 求出最大值 for(int i=1;i<=n;i++) { if(node[i].reward>node[0].reward) { node[0].name=node[i].name; node[0].reward=node[i].reward; } tot+=node[i].reward;//求和 } cout<<node[0].name<<endl<<node[0].reward<<endl<<tot<<endl;//输出 } int main(){ cin>>n; for(int i=1;i<=n;i++)cin>>node[i].name>>node[i].qm>>node[i].bp>>node[i].xg>>node[i].xs>>node[i].lwn; solve(); return 0; } -
0@ 2016-10-05 10:05:15
#include <iostream> #include <string> #include <cstring> using namespace std; struct student { string name; int final_score; int class_score; bool boss; bool west; int artical; int money; }; student stu[102]; int main() { int n; cin >> n; char is_boss, is_west; int most_money = 0, most_name = 0, total = 0; for (int i = 1; i <= n; ++i) { cin >> stu[i].name; cin >> stu[i].final_score; cin >> stu[i].class_score; cin >> is_boss; stu[i].boss = (is_boss == 'Y') ? true : false; cin >> is_west; stu[i].west = (is_west == 'Y') ? true : false; cin >> stu[i].artical; stu[i].money = 0; if (stu[i].final_score > 80 && stu[i].artical >= 1) stu[i].money += 8000; if (stu[i].final_score > 85 && stu[i].class_score > 80) stu[i].money += 4000; if (stu[i].final_score > 90) stu[i].money += 2000; if (stu[i].west && stu[i].final_score > 85) stu[i].money += 1000; if (stu[i].boss && stu[i].class_score > 80) stu[i].money += 850; total += stu[i].money; if (stu[i].money > most_money) { most_name = i; most_money = stu[i].money; } } cout << stu[most_name].name << endl; cout << stu[most_name].money << endl; cout << total << endl; return 0; } -
0@ 2016-09-11 16:31:22
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
int s1[a],s2[a],b[a],m1[a],sum=0,m2[a];
string n[a],g[a],x[a];
for (int i=0;i<a;i++){
cin>>n[i]>>s1[i]>>s2[i]>>g[i]>>x[i]>>b[i];
m1[i]=0;
if (s1[i]>80&&b[i]>0)
m1[i]+=8000;
if (s1[i]>85&&s2[i]>80)
m1[i]+=4000;
if (s1[i]>90)
m1[i]+=2000;
if (s1[i]>85&&x[i]=="Y")
m1[i]+=1000;
if (s2[i]>80&&g[i]=="Y")
m1[i]+=850;
sum+=m1[i];
m2[i]=m1[i];
}
for (int i=0;i<a-1;i++){
if (m1[i]>=m1[i+1])
m1[i+1]=m1[i];
}
for (int i=0;i<a;i++){
if (m2[i]==m1[a-1]){
cout<<n[i]<<endl;
break;
}
}
cout<<m1[a-1]<<endl;
cout<<sum<<endl;
} -
0@ 2016-08-30 15:22:36
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
char a[25];
void copy(char x[],char y[],int len)
{
for(int i=1;i<=len;i++)
x[i]=y[i];
}
int main()
{
int n,tot=0,maxn=-9999999,lenth;
scanf("%d",&n);
while(n--)
{
int len=0;
char s[25];
while(1)
{
char x;
scanf("%c",&x);
if(x==' ')break;
s[++len]=x;
}
int cnt=0,mo,ban,lun;
char gan,sheng;
cin>>mo>>ban>>gan>>sheng>>lun;
if(mo>80&&lun>=1){cnt+=8000;tot+=8000;}
if(mo>85&&ban>80){cnt+=4000;tot+=4000;}
if(mo>90){cnt+=2000;tot+=2000;}
if(mo>85&&sheng=='Y'){cnt+=1000;tot+=1000;}
if(ban>80&&gan=='Y'){cnt+=850;tot+=850;}
if(cnt>maxn)
{
copy(a,s,len);
maxn=cnt;
lenth=len;
}
}
for(int i=1;i<=lenth;i++)
printf("%c",a[i]);
printf("\n%d\n%d",maxn,tot);
} -
0@ 2016-08-23 19:13:46
sort超爽
#include<bits/stdc++.h>
using namespace std;
struct node
{
int moy,cx;
char nm[21];
}q[100001];
bool cmp(node a,node b)
{
if(a.moy>b.moy) return 1;
if(a.moy<b.moy) return 0;
if(a.moy==b.moy)
{
if(a.cx<b.cx) return 1;
else return 0;
}
}
int main()
{
int i,n,qm,bj,lw,s;//qm期末成绩,bj班级评分,lw论文数量。
char gb,xb;//gb学生干部,xb西部
cin>>n;
s=0;
for(i=1;i<=n;i++)
{
cin>>q[i].nm>>qm>>bj>>gb>>xb>>lw;
q[i].moy=0;
if(qm>80&&lw>=1) q[i].moy+=8000;
if(qm>85&&bj>80) q[i].moy+=4000;
if(qm>90) q[i].moy+=2000;
if(qm>85&&xb=='Y') q[i].moy+=1000;
if(bj>80&&gb=='Y') q[i].moy+=850;
s+=q[i].moy;
q[i].cx=i;
}
sort(q+1,q+1+n,cmp);
cout<<q[1].nm<<endl;
cout<<q[1].moy<<endl;
cout<<s;
return 0;
} -
0@ 2016-08-18 14:14:55
type student=record qmcj:longint; bjpy:longint; xsgb:boolean; xbsf:boolean; lwps:longint; money:longint; end; var n,i,j,ans:longint; ch:char; a:array[1..200]of student; names:array[1..300]of string; max:student; name:string; begin readln(n); for i:=1 to n do begin read(ch); while ch<>' ' do begin inc(j); names[i]:=names[i]+ch; //writeln(names[i][j]); read(ch); end; read(a[i].qmcj,a[i].bjpy); read(ch); read(ch); if ch='Y' then a[i].xsgb:=true else a[i].xsgb:=false; read(ch); read(ch); if ch='Y' then a[i].xbsf:=true else a[i].xbsf:=false; readln(a[i].lwps); end; for i:=1 to n do begin if (a[i].qmcj>80)and(a[i].lwps>=1) then inc(a[i].money,8000); if (a[i].qmcj>85)and(a[i].bjpy>80) then inc(a[i].money,4000); if (a[i].qmcj>90) then inc(a[i].money,2000); if (a[i].qmcj>85)and(a[i].xbsf=true) then inc(a[i].money,1000); if (a[i].bjpy>80)and(a[i].xsgb=true) then inc(a[i].money,850); end; for i:=1 to n do begin if max.money<a[i].money then begin name:='';name:=name+names[i];max:=a[i];end; inc(ans,a[i].money); //writeln(names[i]); end; //for i:=1 to length(name) do write(name[i]); writeln(name); writeln(max.money); write(ans); end.pascal AC
-
0@ 2016-08-17 12:19:53
#include<iostream>
#include<string.h>
using namespace std;
char d,e;
string a,g;
int main()
{
int i,b,c,f,n,m=0,k=0,s=0;
cin>>n;
for(i=1;i<=n;i++){
cin>>a>>b>>c>>d>>e>>f;
m=0;
if(b>80&&f>=1) m+=8000;
if(b>85&&c>80) m+=4000;
if(b>90) m+=2000;
if(b>85&&e=='Y') m+=1000;
if(c>80&&d=='Y') m+=850;
s+=m;
if(k<m){
k=m;
g=a;
}
}
cout<<g<<endl<<k<<endl<<s<<endl;
return 0;
} -
0@ 2016-08-13 14:15:56
C++简单易懂结构体:
#include <string>
#include <iostream>
using namespace std;
struct Person
{
string name;
int aver;
int com;
char isl;
char isw;
int num;
int sum1;
};
Person person[100];
int main()
{
int n,sum2=0,i;
cin>>n;
for(i=0;i<n;i++)
{
person[i].sum1=0;
cin>>person[i].name>>person[i].aver>>person[i].com>>person[i].isl
>>person[i].isw>>person[i].num;if(person[i].aver>80&&person[i].num>=1)
{
person[i].sum1+=8000;
sum2+=8000;
}
if(person[i].aver>85&&person[i].com>80)
{
person[i].sum1+=4000;
sum2+=4000;
}
if(person[i].aver>90)
{
person[i].sum1+=2000;
sum2+=2000;
}
if(person[i].aver>85&&person[i].isw=='Y')
{
person[i].sum1+=1000;
sum2+=1000;
}
if(person[i].com>80&&person[i].isl=='Y')
{
person[i].sum1+=850;
sum2+=850;
}
}
string str2=person[0].name;
int sum3=person[0].sum1;
for(i=1;i<n;i++)
{
if(person[i].sum1>sum3)
{
str2=person[i].name;
sum3=person[i].sum1;
}
}cout<<str2<<endl;
cout<<sum3<<endl;
cout<<sum2<<endl;return 0;
} -
0@ 2016-08-10 13:44:07
模拟.
c++ code
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;int main()
{
int a,b,c,n,i,money,sum,maxn; char name[100],x[100],y[100],boss[100];
scanf("%d",&n); sum=0; maxn=0;
for(i=1;i<=n;i++){
money=0;
scanf("%s%d%d%s%s%d",&name,&a,&b,&x,&y,&c);
if(a>80 && c>=1){money=money+8000;}
if(a>85 && b>80){money=money+4000;}
if(a>90){money=money+2000;}
if(a>85 && strcmp(y, "Y")==0){money=money+1000;}
if(b>80 && strcmp(x, "Y")==0){money=money+850;}
if(money>maxn){
strcpy(boss,name); maxn=money;
}
sum=sum+money;
}
printf("%s\n%d\n%d",boss,maxn,sum);
return 0;
} -
0@ 2016-07-31 19:34:14
这题实在简单啊……连普及组难度都不及啊……提高组考语言篇吗?
c++
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
int n;
int ans(int point1,int point2,bool work,bool west,int art)
{
int re=0;
if(art>=1&&point1>80)
re+=8000;
if(point2>80&&point1>85)
re+=4000;
if(point1>90)
re+=2000;
if(point1>85&&west==true)
re+=1000;
if(point2>80&&work==true)
re+=850;
return re;
}
int main()
{
cin>>n;
char ans_name[25];
int maxmoney=0,allmoney=0,i=n;
while(i--)
{
char inname[25],work1,west1;
int point1,point2,art;
bool work,west;
cin>>inname>>point1>>point2>>work1>>west1>>art;
if(work1=='Y')
work=true;
else
work=false;
if(west1=='Y')
west=true;
else
west=false;
int money=ans(point1,point2,work,west,art);
allmoney+=money;
if(money>maxmoney)
{
maxmoney=money;
strcpy(ans_name,inname);
}
}
cout<<ans_name<<endl<<maxmoney<<endl<<allmoney;
return 0;
}
-
0@ 2016-07-23 13:42:58
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;cin>>n;int maxx = 0;string maxname;int tosum = 0;
string name;int qimo;int banji;char ganbu;char xibu;int lunwen;
for(int i=1;i<=n;i++){
int sum = 0;
cin>>name>>qimo>>banji>>ganbu>>xibu>>lunwen;
if (qimo > 80 && lunwen >= 1){
sum=sum+8000;
}
if (qimo > 85 && banji > 80){
sum=sum+4000;
}
if (qimo > 90){
sum=sum+2000;
}
if (qimo > 85 && xibu =='Y'){
sum=sum+1000;
}
if (banji > 80 && ganbu == 'Y'){
sum=sum+850;
}
if (sum>maxx){
maxx = sum;
maxname = name;
}
tosum=tosum + sum ;}
cout<<maxname<<endl;
cout<<maxx<<endl;
cout<<tosum<<endl;
return 0;} -
0@ 2016-07-22 16:02:36
fssdgf
-
0@ 2016-07-22 16:02:12
其实很简单,记录类型就ac,就是读入有点麻烦
```pascalprogram fds;
type jilu=record
names:array[1..100] of char;
kaofen:longint;
banfen:longint;
bangb:char;
xibu:char;
runwen:longint;
zong:longint;
xu:longint;
chang:longint;
end;
var a:array[1..101] of jilu;
i,j,k,l,v,s,t,o,n,g:longint;
beginreadln(n);
for i:=1 to n do
begin
g:=0;
repeat
g:=g+1;
read(a[i].names[g]);
until a[i].names[g]=' ';
a[i].chang:=g-1;readln(a[i].kaofen,a[i].banfen,a[i].bangb,a[i].bangb,a[i].xibu,a[i].xibu,a[i].runwen);
if (a[i].kaofen>80) and (a[i].runwen>=1) then a[i].zong:=8000+a[i].zong;
if (a[i].kaofen>85) and (a[i].banfen>80) then a[i].zong:=4000+a[i].zong;
if (a[i].kaofen>90) then a[i].zong:=2000+a[i].zong;
if (a[i].kaofen>85) and (a[i].xibu='Y')then a[i].zong:=1000+a[i].zong;
if (a[i].banfen>80) and (a[i].bangb='Y') then a[i].zong:=850+a[i].zong;
a[i].xu:=i;
end;
v:=0;
s:=0;
o:=0;
for i:=1 to n do begin
o:=o+a[i].zong;
if a[i].zong>s then begin v:=a[i].xu; s:=a[i].zong; end;end;
for i:=1 to a[v].chang do write(a[v].names[i]);writeln;
writeln(a[v].zong);
writeln(o);
end.``` -
0@ 2016-07-16 21:07:14
最简单的选择分支,一个个写就行了
#include<iostream> using namespace std; int main() { string a,g; int b,c,f,n,money=0,result=0,sum=0; char d,e; cin>>n; for(int i=1;i<=n;i++) { cin>>a>>b>>c>>d>>e>>f; money=0; if(b>80&&f>=1) money+=8000;//院士奖学金 if(b>85&&c>80) money+=4000;//五四奖学金 if(b>90) money+=2000;//成绩优秀奖 if(b>85&&e=='Y') money+=1000;//西部奖学金 if(c>80&&d=='Y') money+=850;//班级贡献奖 sum+=money;//奖金总和 if(result<money) { result=money; g=a;//记录名字 } } cout<<g<<endl<<result<<endl<<sum<<endl; return 0; }``` -
0@ 2016-07-16 21:05:48
最简单的选择分支,一个个写就行了
-
0@ 2016-07-04 16:25:42
测试数据 #0: Accepted, time = 0 ms, mem = 484 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 484 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 488 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 484 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 488 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 488 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 488 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 484 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 484 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 492 KiB, score = 10
Accepted, time = 0 ms, mem = 492 KiB, score = 100C:
#include <stdio.h>
int main() {
struct stu{
char name[20];
int num1;
int num2;
char ch1;
char ch2;
int num3;
int sum;
} str[101];
int n, i;
scanf("%d", &n);
for(i=0; i<n; i++) {
scanf("\n");
scanf("%s", &str[i].name);
scanf("%d", &str[i].num1);
scanf("%d", &str[i].num2);
scanf(" ");
scanf("%c", &str[i].ch1);
scanf(" ");
scanf("%c", &str[i].ch2);
scanf("%d", &str[i].num3);
}
for(i=0; i<n; i++) {
str[i].sum = 0;
if(str[i].num1>80 && str[i].num3>=1) str[i].sum+=8000;
if(str[i].num1>85 && str[i].num2>80) str[i].sum+=4000;
if(str[i].num1>90) str[i].sum+=2000;
if(str[i].num1>85 && str[i].ch2=='Y') str[i].sum+=1000;
if(str[i].num2>80 && str[i].ch1=='Y') str[i].sum+= 850;
}
long max=0, sum1=0;
for(i=0; i<n; i++) {
if(str[i].sum > str[max].sum) max = i;
sum1 += str[i].sum;
}
printf("%s\n%ld\n%ld", str[max].name, str[max].sum, sum1);
return 0;
}