522 条题解
-
0
DEFCON LV 8 @ 2016-06-21 13:01:36
#include<stdio.h>
#include<string.h>
struct student
{
char name[100];
int ascore;
int cscore;
char cadre;
char west;
int paper;
int money;
}stu[100];
int main()
{
int n;
int s=0;
//int m=0;
int t1;
char t2[100],tmp[128];
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].ascore,&stu[i].cscore,&stu[i].cadre,&stu[i].west,&stu[i].paper);
for(int j=0;j<n;j++)
{
if(stu[j].ascore>80&&stu[j].paper>=1)
stu[j].money+=8000;
if(stu[j].ascore>85&&stu[j].cscore>80)
stu[j].money+=4000;
if(stu[j].ascore>90)
stu[j].money+=2000;
if(stu[j].ascore>85&&stu[j].west=='Y')
stu[j].money+=1000;
if(stu[j].cscore>80&&stu[j].cadre=='Y')
stu[j].money+=850;
}
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
if(stu[k].money<stu[k+1].money)
{
t1=stu[k].money;
stu[k].money=stu[k+1].money;
stu[k+1].money=t1;
strcpy(tmp,stu[k].name);
strcpy(stu[k].name,stu[k+1].name);
strcpy(stu[k+1].name,tmp);
}
}
}
for(int l=0;l<n;l++)
{
s+=stu[l].money;
}
printf("%s\n%d\n%d",stu[0].name,stu[0].money,s);
return 0;
} -
0@ 2016-05-29 10:45:05
#include<stdio.h> #include<string.h> int sum=0,sum1=0,sum2=0; void check(int ,int ,char ,char ,int); void D(char *,char *); int main() { freopen("1.in","r",stdin); int n=0; scanf("%d",&n); char name[30]={'\0'},name1[30]={'\0'},z='\0',z1='\n',w; int endg=0,endp=0,lw=0; for(int i=0;i<n;i++) { scanf("%s",name1); scanf("%d",&endg); scanf("%d",&endp); scanf("%c%c",&w,&z); scanf("%c%c",&w,&z1); scanf("%d",&lw); check(endg,endp,z,z1,lw); if(sum2>sum) { sum=sum2; D(name,name1); } sum2=0; endg=0; endp=0; lw=0; } printf("%s\n%d\n%d\n",name,sum,sum1); } void check(int a,int b,char a1,char b1,int c) { if(a>80&&c>0) { sum1+=8000; sum2+=8000; } if(a>85&&b>80) { sum1+=4000; sum2+=4000; } if(a>90) { sum1+=2000; sum2+=2000; } if(a>85&&b1=='Y') { sum1+=1000; sum2+=1000; } if(b>80&&a1=='Y') { sum1+=850; sum2+=850; } } void D(char *a,char *b) { for(int i=0;i<30;i++) a[i]=b[i]; }哪里错了?请大神指教
-
0@ 2016-05-21 19:49:55
var
i,j,max,n,t,sum:longint;
nam:array[0..101] of string;
ch1,ch2:array[0..101] of string;
c1,c2,mon,l:array[0..101] of longint;
k,s:string;
begin
readln(n);
max:=-1;
for i:=1 to n do
begin
readln(s);
s:=s+' ';
t:=pos(' ',s);
nam[i]:=copy(s,1,t-1); //youbian zifuchuan
delete(s,1,t);sum:=0;
t:=pos(' ',s);
k:=copy(s,1,t-1);
delete(s,1,t);
for j:=1 to length(k) do
sum:=sum*10+ord(k[j])-48;
c1[i]:=sum;sum:=0;
t:=pos(' ',s);
k:=copy(s,1,t-1);
delete(s,1,t);
for j:=1 to length(k) do
sum:=sum*10+ord(k[j])-48;
c2[i]:=sum;t:=pos(' ',s);
ch1[i]:=copy(s,1,t-1);
delete(s,1,t);t:=pos(' ',s);
ch2[i]:=copy(s,1,t-1);
delete(s,1,t);sum:=0;
t:=pos(' ',s);
k:=copy(s,1,t-1);
delete(s,1,t);
for j:=1 to length(k) do
sum:=sum*10+ord(k[j])-48;
l[i]:=sum;
end;
sum:=0;
for i:=1 to n do
begin
if (c1[i]>80) and (l[i]>=1)
then
mon[i]:=mon[i]+8000;
if (c1[i]>85) and (c2[i]>80)
then
mon[i]:=mon[i]+4000;
if c1[i]>90
then
mon[i]:=mon[i]+2000;
if (c1[i]>85) and (ch2[i]='Y')
then
mon[i]:=mon[i]+1000;
if (c1[i]>80) and (ch1[i]='Y')
then
mon[i]:=mon[i]+850;
end;
for i:=1 to n do
if mon[i]>max
then
begin
max:=mon[i];
k:=nam[i];
end;
for i:=1 to n do
sum:=sum+mon[i];
writeln(k);
writeln(max);
writeln(sum);
readln;end.
-
0@ 2016-05-14 19:12:02
#include <iostream>
#include <cstring>using namespace std;
int ys(int a,int b){
if(a>80&&b>=1)
return 8000;
else
return 0;
}int ws(int a,int b){
if(a>85&&b>80)
return 4000;
else
return 0;
}int cj(int a){
if(a>90)
return 2000;
else
return 0;
}int fxb(int a,char b){
if(a>85&&b=='Y')
return 1000;
else
return 0;
}int fbj(int a,char b){
if(a>80&&b=='Y')
return 850;
else
return 0;
}int main(){
int total;
cin>>total;string name[total];
int qm[total],bj[total],paper[total];
char gb[total],xb[total];for(int q=0;q<total;q++)
cin>>name[q]>>qm[q]>>bj[q]>>gb[q]>>xb[q]>>paper[q];int money[total];
for(int z=0;z<total;z++)
money[z]=0;for(int qq=0;qq<total;qq++){
money[qq]=ys(qm[qq],paper[qq])+ws(qm[qq],bj[qq])+cj(qm[qq])+fxb(qm[qq],xb[qq])+fbj(bj[qq],gb[qq]);
}int s=0,n=0,all=0;
for(int w=0;w<total;w++){
all=all+money[w];
if(s<money[w]){
s=money[w];
n=w;
}
}cout<<name[n]<<endl;
cout<<money[n]<<endl;
cout<<all;return 0;
} -
0@ 2016-05-10 22:27:07
"""c
#include <stdio.h>
#define MAX_NUM 100
#define MAX_LEN 22
typedef struct information
{
char name[MAX_LEN];
int end_grade;
int class_grade;
char Is_monitor;
char Is_western;
int article_number;
int award_money;
}Student;int main(void)
{
int students_number;
scanf("%d",&students_number);
Student students_catalog[students_number];
int i;
for(i=0;i<students_number;i++)
{
scanf("%s %d %d",students_catalog[i].name,&(students_catalog[i].end_grade),&(students_catalog[i].class_grade));
getchar();
scanf("%c %c %d",&(students_catalog[i].Is_monitor),&(students_catalog[i].Is_western),&(students_catalog[i].article_number));
getchar();
students_catalog[i].award_money=0;
}
int index=0;
int money_max=0;
int all_money=0;
for(i=0;i<students_number;i++)
{
if(students_catalog[i].end_grade>80 && students_catalog[i].article_number>=1)
students_catalog[i].award_money+=8000;
if(students_catalog[i].end_grade>85 && students_catalog[i].class_grade>80)
students_catalog[i].award_money+=4000;
if(students_catalog[i].end_grade>90)
students_catalog[i].award_money+=2000;
if(students_catalog[i].end_grade>85 && students_catalog[i].Is_western=='Y')
students_catalog[i].award_money+=1000;
if(students_catalog[i].class_grade>80 && students_catalog[i].Is_monitor=='Y')
students_catalog[i].award_money+=850;
if(students_catalog[i].award_money>money_max)
{
money_max=students_catalog[i].award_money;
index=i;
}
all_money+=students_catalog[i].award_money;
}
printf("%s\n",students_catalog[index].name);
printf("%d\n",money_max);
printf("%d\n",all_money);
return 0;
}
""" -
0@ 2016-05-10 22:26:30
'''c
#include <stdio.h>
#define MAX_NUM 100
#define MAX_LEN 22
typedef struct information
{
char name[MAX_LEN];
int end_grade;
int class_grade;
char Is_monitor;
char Is_western;
int article_number;
int award_money;
}Student;int main(void)
{
int students_number;
scanf("%d",&students_number);
Student students_catalog[students_number];
int i;
for(i=0;i<students_number;i++)
{
scanf("%s %d %d",students_catalog[i].name,&(students_catalog[i].end_grade),&(students_catalog[i].class_grade));
getchar();
scanf("%c %c %d",&(students_catalog[i].Is_monitor),&(students_catalog[i].Is_western),&(students_catalog[i].article_number));
getchar();
students_catalog[i].award_money=0;
}
int index=0;
int money_max=0;
int all_money=0;
for(i=0;i<students_number;i++)
{
if(students_catalog[i].end_grade>80 && students_catalog[i].article_number>=1)
students_catalog[i].award_money+=8000;
if(students_catalog[i].end_grade>85 && students_catalog[i].class_grade>80)
students_catalog[i].award_money+=4000;
if(students_catalog[i].end_grade>90)
students_catalog[i].award_money+=2000;
if(students_catalog[i].end_grade>85 && students_catalog[i].Is_western=='Y')
students_catalog[i].award_money+=1000;
if(students_catalog[i].class_grade>80 && students_catalog[i].Is_monitor=='Y')
students_catalog[i].award_money+=850;
if(students_catalog[i].award_money>money_max)
{
money_max=students_catalog[i].award_money;
index=i;
}
all_money+=students_catalog[i].award_money;
}
printf("%s\n",students_catalog[index].name);
printf("%d\n",money_max);
printf("%d\n",all_money);
return 0;
}
''' -
0@ 2016-04-06 17:46:33
#include <iostream>
using namespace std;int main()
{
int n;
cin >> n;
int a[100][3];
char b[100][21];
char c[100][2];
int m[100] = {0};
for(int i = 0; i < n; i++ )
{
cin >> b[i];
for(int j = 0; j< 2;j++)
{
cin >> a[i][j];
}
for(int j = 0; j < 2;j++)
{
cin >> c[i][j];
}
cin >> a[i][2];
}
for(int i = 0; i < n; i++)
{
if(a[i][0] > 80 && a[i][2] >=1 )
m[i] += 8000;
if(a[i][0] > 85 && a[i][1] > 80 )
m[i] += 4000;
if(a[i][0] > 90)
m[i] += 2000;
if(a[i][0] > 85 && c[i][1] == 'Y')
m[i] += 1000;
if(a[i][1] > 80 && c[i][0] == 'Y')
m[i] += 850;
}
int total = 0;
for(int i = 0; i <n; i++)
{
total += m[i];
}
int e =0;
for (int i = 0; i< n;i++)
{;
if(m[e] < m[i])
e = i;
}
cout << b[e] <<endl;
cout << m[e] << endl;
cout << total;
system("pause");
} -
0@ 2016-03-29 22:48:37
import java.util.*;
import static java.lang.System.*;
public class Main{
static Scanner in = new Scanner(System.in);public static void main(String[] args){
int n;
n=in.nextInt();
String id = null;
int mx=-1,sum=0;
for(int i=0;i<n;i++)
{
in.nextLine();
int award=0;
String name=in.next();
int score=in.nextInt();
int mark=in.nextInt();
String cadre=in.next();
String isXB=in.next();
int paples=in.nextInt();if(score>80&&paples>=1)
award+=8000;
if(score>85&&mark>80)
award+=4000;
if(score>90)
award+=2000;
if(score>85&&isXB.charAt(0)=='Y')
award+=1000;
if(mark>80&&cadre.charAt(0)=='Y')
award+=850;
if(award>mx)
{ id=name;
mx=award;
}
sum+=award;
}
out.println(id);
out.println(mx);
out.println(sum);
}
} -
0@ 2016-03-23 13:19:38
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define max 100000
using namespace std;
int tot[max];
int maxn,sum,re;
struct STU
{
string name;
int gra1,gra2,pas;
char a,b;
}stu[max];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>stu[i].name>>stu[i].gra1>>stu[i].gra2>>stu[i].a>>stu[i].b>>stu[i].pas;
if(stu[i].gra1>80&&stu[i].pas) tot[i]+=8000;
if(stu[i].gra1>85&&stu[i].gra2>80) tot[i]+=4000;
if(stu[i].gra1>90) tot[i]+=2000;
if(stu[i].gra1>85&&stu[i].b=='Y') tot[i]+=1000;
if(stu[i].gra2>80&&stu[i].a=='Y') tot[i]+=850;
}
for(int i=1;i<=n;i++)
{
if(tot[i]>maxn) {maxn=tot[i]; re=i;}
sum+=tot[i];
}
cout<<stu[re].name<<'\n'<<maxn<<'\n'<<sum;
return 0;
} -
0@ 2016-03-15 17:40:33
include<iostream>
include<algorithm>
include<cstdio>
include<stdio.h>
using namespace std;
bool flag=true;int s;
struct sdd{
char name[101];
int qimo;
int banji;
char ganbu;
char xibu;
int lunwen;
int jj;
}a[101];
int comp(const sdd&a,const sdd&b){
return a.jj>b.jj;
}
int main(){
int n;cin>>n;
for(int i=1;i<=n;++i){
scanf("%s%d%d %c %c%d\n",&a[i].name,&a[i].qimo,&a[i].banji,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
}
for(int i=1;i<=n;++i){
if(a[i].qimo>80&&a[i].lunwen>=1)a[i].jj+=8000;
if(a[i].qimo>85&&a[i].banji>80)a[i].jj+=4000;
if(a[i].qimo>90)a[i].jj+=2000;
if(a[i].qimo>85&&a[i].xibu=='Y')a[i].jj+=1000;
if(a[i].banji>80&&a[i].ganbu=='Y')a[i].jj+=850;
}
sort(a+1,a+n+1,comp);
for(int i=1;i<=n;++i){
s+=a[i].jj;
}
cout<<a[1].name<<endl<<a[1].jj<<endl<<s;
return 0;
} -
0@ 2016-03-13 13:47:18
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
using namespace std;
bool flag=true;int s;
struct sdd{
char name[101];
int qimo;
int banji;
char ganbu;
char xibu;
int lunwen;
int jj;
}a[101];
int comp(const sdd&a,const sdd&b){
return a.jj>b.jj;
}
int main(){
int n;cin>>n;
for(int i=1;i<=n;++i){
scanf("%s%d%d %c %c%d\n",&a[i].name,&a[i].qimo,&a[i].banji,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
}
for(int i=1;i<=n;++i){
if(a[i].qimo>80&&a[i].lunwen>=1)a[i].jj+=8000;
if(a[i].qimo>85&&a[i].banji>80)a[i].jj+=4000;
if(a[i].qimo>90)a[i].jj+=2000;
if(a[i].qimo>85&&a[i].xibu=='Y')a[i].jj+=1000;
if(a[i].banji>80&&a[i].ganbu=='Y')a[i].jj+=850;
}
sort(a+1,a+n+1,comp);
for(int i=1;i<=n;++i){
s+=a[i].jj;
}
cout<<a[1].name<<endl<<a[1].jj<<endl<<s;
return 0;
}
才90分啊 告诉我还有一个答案出错在哪里!!!!!!!!!!! -
0@ 2016-03-10 20:18:15
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d\n",&n);
struct wo
{
char ming[25]; int qi; int ban; char a; char b; int lun; int zong=0;
}stu[123];
int i,max=0,ji=0,gong=0;
for(i=0;i<n;i++)
{
scanf("%s %d %d %c %c %d",stu[i].ming,&stu[i].qi,&stu[i].ban,&stu[i].a,&stu[i].b,&stu[i].lun);
if((stu[i].qi>80)&&(stu[i].lun>=1)) stu[i].zong+=8000;
if((stu[i].qi>85)&&(stu[i].ban>80)) stu[i].zong+=4000;
if(stu[i].qi>90) stu[i].zong+=2000;
if((stu[i].qi>85)&&(stu[i].b=='Y')) stu[i].zong+=1000;
if((stu[i].ban>80)&&(stu[i].a=='Y')) stu[i].zong+=850;
gong+=stu[i].zong;
if(stu[i].zong>max) { ji=i; max=stu[i].zong; }
}
printf("%s\n%d\n%d",stu[ji].ming,max,gong);
return 0;
}//请问哪里错了 -
0@ 2016-02-22 14:27:50
#**面向对象的写法**
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in))); student[] students=new student[sc.nextInt()]; for (int i = 0; i < students.length; i++) students[i]=new student(sc.next(),sc.nextInt(),sc.nextInt(),sc.next().equals("Y")?true:false,sc.next().equals("Y")?true:false,sc.nextInt()); Arrays.sort(students, new comparator()); int total = 0; for (student student : students) total+=student.getMoney(); System.out.println(students[students.length-1].getName()+"\n"+students[students.length-1].getMoney()+"\n"+total); } } //奖学金比较器 class comparator implements Comparator<student>{ public int compare(student o1, student o2) { if(o1.getMoney()!=o2.getMoney()) return o1.getMoney()>o2.getMoney()?1:-1; else return 0; } } class student{ private String name; private int averageScore; private int classScore; private boolean isCadres; private boolean isEast; private int num; private int money=0; public student(String name,int averageScore,int classScore,boolean isCadres,boolean isEast,int num) { this.name=name; this.averageScore=averageScore; this.classScore=classScore; this.isCadres=isCadres; this.isEast=isEast; this.num=num; this.money+=(averageScore>80&&num>=1)?8000:0; this.money+=(averageScore>85&&classScore>80)?4000:0; this.money+=averageScore>90?2000:0; this.money+=(averageScore>85&&isEast)?1000:0; this.money+=(classScore>80&&isCadres)?850:0; } //getter和setter public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAverageScore() { return averageScore; } public void setAverageScore(int averageScore) { this.averageScore = averageScore; } public int getClassScore() { return classScore; } public void setClassScore(int classScore) { this.classScore = classScore; } public boolean isCadres() { return isCadres; } public void setCadres(boolean isCadres) { this.isCadres = isCadres; } public boolean isEast() { return isEast; } public void setEast(boolean isEast) { this.isEast = isEast; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public int getMoney() { return money; } public void setMoney(int money) { this.money = money; } } -
0@ 2016-02-18 11:01:31
/* *********************************************** Author :guanjun Created Time :2016/2/18 9:23:52 File Name :vijos1001.cpp ************************************************ */ #include <iostream> #include <cstring> #include <cstdlib> #include <stdio.h> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <math.h> #include <stdlib.h> #include <iomanip> #include <list> #include <deque> #include <stack> #define ull unsigned long long #define ll long long #define mod 90001 #define INF 0x3f3f3f3f #define maxn 10000+10 #define cle(a) memset(a,0,sizeof(a)) const ull inf = 1LL << 61; const double eps=1e-5; using namespace std; struct node{ string name; int avg; int bs; int ganbu; int xibu; int lunwen,money; node(){ ganbu=0; xibu=0; lunwen=0; money=0; } }nod[110]; int main() { #ifndef ONLINE_JUDGE //freopen("in.txt","r",stdin); #endif //freopen("out.txt","w",stdout); int n; char a,b; while(cin>>n){ for(int i=1;i<=n;i++){ cin>>nod[i].name>>nod[i].avg>>nod[i].bs>>a>>b>>nod[i].lunwen; if(a=='Y')nod[i].ganbu=1; if(b=='Y')nod[i].xibu=1; } int sum=0,mid; string mm; int Max=-INF; for(int i=1;i<=n;i++){ if(nod[i].avg>80&&nod[i].lunwen>=1){ nod[i].money+=8000; } if(nod[i].avg>85&&nod[i].bs>80){ nod[i].money+=4000; } if(nod[i].avg>90)nod[i].money+=2000; if(nod[i].avg>85&&nod[i].xibu)nod[i].money+=1000; if(nod[i].bs>80&&nod[i].ganbu)nod[i].money+=850; sum+=nod[i].money; if(nod[i].money>Max)Max=nod[i].money,mid=i; //cout<<nod[i].money<<endl; } cout<<nod[mid].name<<endl; cout<<nod[mid].money<<endl; cout<<sum<<endl; } return 0; } -
0@ 2016-01-08 19:36:36
#include <iostream>
#include <cstring>
using namespace std;struct student
{
string name;
int qmcj;
int pycj;
char gb;
char west;
int lw;
int sum=0;
};student a[101];
int i, n;
long long sum = 0;
int maxpos, maxl=0;int main()
{
cin >> n;
for (i = 1; i <= n; i++)
{
cin>>a[i].name>>a[i].qmcj>>a[i].pycj>>a[i].gb>>a[i].west>>a[i].lw;
if (a[i].qmcj > 80 && a[i].lw >= 1)
a[i].sum += 8000;
if (a[i].qmcj > 85 && a[i].pycj > 80)
a[i].sum += 4000;
if (a[i].qmcj > 90)
a[i].sum += 2000;
if (a[i].qmcj > 85 && a[i].west == 'Y')
a[i].sum += 1000;
if (a[i].pycj > 80 && a[i].gb == 'Y')
a[i].sum += 850;
sum += a[i].sum;
if (a[i].sum > maxl)
{
maxpos = i;
maxl=a[i].sum;
}
cin.clear();
}
cout << a[maxpos].name << endl;;
cout << a[maxpos].sum << endl;
cout << sum;
return 0;
} -
0@ 2015-12-29 18:35:26
各位大神求找错
第二个测试点没过
O(∩_∩)O谢谢
type rqq=record
name:string[20];
qm:0..100;
bj:0..100;
gb:char;
xb:char;
lw:0..10;
money:0..15850;
end;
var n,i,b,c:integer;
s:longint;
a:char;
k:array[1..105] of rqq;
begin
readln(n);
for i:=1 to n do
begin
read(a);
while a<>' ' do
begin k[i].name:=k[i].name+a; read(a); end;
read(k[i].qm,k[i].bj);
read(a);
read(k[i].gb);
read(a);
read(k[i].xb,k[i].lw);
end;
for i:=1 to n do
begin
if (k[i].qm>80)and(k[i].lw>0) then k[i].money:=k[i].money+8000;
if (k[i].qm>85)and(k[i].bj>80) then k[i].money:=k[i].money+4000;
if k[i].qm>90 then k[i].money:=k[i].money+2000;
if (k[i].qm>85)and(k[i].xb='Y') then k[i].money:=k[i].money+1000;
if (k[i].bj>80)and(k[i].gb='Y') then k[i].money:=k[i].money+850;
s:=s+k[i].money;
end;
b:=-1;
for i:=1 to n do
if k[i].money>b then
begin b:=k[i].money; c:=i; end;
writeln(k[c].name);
writeln(b);
writeln(s);
end. -
0@ 2015-12-20 21:08:46
一开始以为要开数组,做完了才发现多此一举了……
可以声明一个记录集类型来存所有数据,每行读入每行计算。
要注意读入名字、是否为班干部、是否为西部学生时的数据采集(烦请大神指教)
后附本蒟蒻题解……
###Pascal Code
program p1001;
type
student=record
na:string;
qm,bj,artical,sum:longint;
gb,west:boolean;
end;
var
s:array[1..100] of student;
n,i,j,sum,max,t:longint;
c:char;
begin
for i:=1 to 100 do
begin
s[i].na:='';
s[i].gb:=False;
s[i].west:=False;
s[i].sum:=0;
end;
max:=0; sum:=0;
readln(n);for i:=1 to n do //read
begin
read(c);
while not (c=' ') do
begin
s[i].na:=s[i].na+c;
read(c);
end;
read(s[i].qm,s[i].bj);
for j:=1 to 4 do
begin
read(c);
if c=' 'then continue;
if (j=2) and (c='Y') then s[i].gb:=True;
if (j=4) and (c='Y') then s[i].west:=True;
end;
readln(s[i].artical); //End read
//Main
t:=0;
if (s[i].qm>80) and (s[i].artical>=1) then inc(t,8000);
if (s[i].qm>85) and (s[i].bj>80) then inc(t,4000);
if s[i].qm>90 then inc(t,2000);
if (s[i].qm>85) and (s[i].west=True) then inc(t,1000);
if (s[i].bj>80) and (s[i].gb=True) then inc(t,850);
if t>s[max].sum then max:=i;
s[i].sum:=t;
sum:=sum+t;
end;
//End Main
writeln(s[max].na); //Write
writeln(s[max].sum);
writeln(sum); //End Write
{for i:=1 to n do //Test
writeln(s[i].na,' ',s[i].qm,' ',s[i].bj,' ',s[i].gb,
' ',s[i].west,' ',s[i].artical);} //End Test
end. -
0@ 2015-12-12 12:44:07
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct node
{
char map[100];
int x,y,z;
char w1,w2;
int m;
int ma;
}num[10000];
bool cmp(node a,node b)
{
if(a.m==b.m)
return a.ma<b.ma;
else
return a.m>b.m;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int ans=0;
int i,j;
for(i=0;i<n;i++)
{
scanf("%s",num[i].map);
scanf("%d%d",&num[i].x,&num[i].y);
getchar();
scanf("%c",&num[i].w1);
getchar();
scanf("%c",&num[i].w2);
scanf("%d",&num[i].z);
num[i].ma=i;
num[i].m=0;
// printf("%s %d %d %c %c %d\n",num[i].map,num[i].x,num[i].y,num[i].w1,num[i].w2,num[i].z);
}
for(i=0;i<n;i++)
{
if(num[i].x>80&&num[i].z>=1)
{
num[i].m+=8000;
}
if(num[i].x>85&&num[i].y>80)
{
num[i].m+=4000;
}
if(num[i].x>90)
num[i].m+=2000;
if(num[i].x>85&&num[i].w2=='Y')
num[i].m+=1000;
if(num[i].y>80&&num[i].w1=='Y')
num[i].m+=850;
ans+=num[i].m;
}
sort(num,num+n,cmp);
printf("%s\n",num[0].map);
printf("%d",num[0].m);
printf("\n%d\n",ans);
}
return 0;
} -
0@ 2015-12-05 21:36:19
测试数据 #0: Wrong answer, time = 150ms, mem = 1042KiB, score = 0
测试数据 #1: Wrong answer, time = 150ms, mem = 1042 KiB, score = 0
测试数据 #2: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #3: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #4: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #5: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #6: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #7: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #8: Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
测试数据 #9:Wrong answer, time = 150 ms, mem = 1042 KiB, score = 0
Wrong answer, time = 1500 ms, mem = 1042 KiB, score = 0
var
a,b,c:array[1..100000]of string;
n,i,j,k,p,d,e,f,f2,g:longint;
c1,c2,c3,c4:char;
z1,z2,z3,z4,z5:array[1..1000000]of longint;
bo:boolean;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
p:=0;d:=0; fillchar(z1,sizeof(z1),0); e:=0;
for i:=1 to n do
begin
k:=0;
for j:=1 to length(a[i]) do
while a[i][j]<>' ' do
begin
b[i][j]:=a[i][j];
inc(k);
end;
k:=k+1;
for j:=k to length(a[i]) do
while a[i][j]<>' ' do
begin
p:=p+ord(a[i][j])-48;
inc(k);
end;
k:=k+1;
for j:=k to length(a[i]) do
while a[i][j]<>' ' do
begin
d:=d+ord(a[i][j])-48;
inc(k);
end;
k:=k+1;
for j:=k to length(a[i]) do
while a[i][j]<>' ' do
begin
c1:=a[i][j];
inc(k);
end;
k:=k+1;
for j:=k to length(a[i]) do
while a[i][j]<>' ' do
begin
c2:=a[i][j];
inc(k);
end;
k:=k+1;
for j:=k to length(a[i]) do
g:=ord(a[i][j])-48;
if (p>80) and (g>0) then z1[i]:=z1[i]+8000;
if (p>85) and (d>80) then z1[i]:=z1[i]+4000;
if (p>90) then z1[i]:=z1[i]+2000;
if (p>85) and ((c2='y') or (c2='Y')) then z1[i]:=z1[i]+1000;
if (p>80) and ((c1='y') or (c1='Y')) then z1[i]:=z1[i]+850;
end;
f2:=1;
repeat
bo:=true;
for i:=1 to n-f2 do
if z1[i]<z1[i+1] then
begin
c[i]:=b[i];
b[i]:=b[i+1];
b[i+1]:=c[i];
z2[i]:=z1[i];
z1[i]:=z1[i+1];
z1[i+1]:=z2[i];
end;
until bo;
for i:=1 to n do
e:=e+z1[i];
writeln(b[1]);
writeln(z1[1]);
writeln(e);
end.
无语了 -
0@ 2015-11-03 23:56:45
###用面向对象的方法,主要为了练习类与对象的使用
#include <iostream>
#include <string>using namespace std;
void Proc1();
int main()
{
Proc1();
return 0;
}class Student
{
public:
Student(string&, short&, short&, char&, char&, short&);
Student();
Student(const Student&);
~Student();
void set_Name(string&);
void set_Final_Score(int&);
void set_Class_Score(int&);
void set_Chairman(char&);
void set_Westman(char&);
string getName();
short Final_Score();
short Class_Score();
char Chairman();
char Westman();
int Scholarship();
private:
string name;
short final_Score,class_Score,paper;
char chairman, westman;
int scholarship;
};Student::Student()
{
name = "";
final_Score = class_Score = 0;
chairman = westman = 'N';
paper = 0;
scholarship = 0;}
Student::Student(string&sname, short&FS, short&CS, char&isChairman, char&isWestman, short&npaper)
{
name = sname;
final_Score = FS;
class_Score = CS;
chairman = isChairman;
westman = isWestman;
paper = npaper;
int tmp = 0;
if (final_Score > 80 && paper >= 1) tmp += 8000;
if (final_Score > 85 && class_Score > 80) tmp += 4000;
if (final_Score > 90)tmp += 2000;
if (final_Score > 85 && westman == 'Y')tmp += 1000;
if (class_Score > 80 && chairman == 'Y')tmp += 850;
scholarship = tmp;
}
Student::Student(const Student&Stu)
{
name = Stu.name;
final_Score = Stu.final_Score;
class_Score = Stu.class_Score;
chairman = Stu.chairman;
westman = Stu.westman;
paper = Stu.paper;
scholarship = Stu.scholarship;
}Student::~Student()
{
}void Student::set_Name(string& sname)
{
name = sname;
}void Student::set_Final_Score(int&fs)
{
final_Score = fs;
}
void Student::set_Class_Score(int&cs)
{
class_Score = cs;
}
void Student::set_Chairman(char&isChairman)
{
chairman = isChairman;
}
void Student::set_Westman(char&isWestman)
{
westman = isWestman;
}
string Student::getName()
{
return name;
}
int Student::Scholarship()
{
return scholarship;
}void Proc1()
{
int n;
cin >> n;
string name_tmp;
short Final_Score, Class_Score,paper;
char isChairman, isWestman;
Student stumax;
int sum = 0;
for (int i = 0; i < n; i++)
{
cin >> name_tmp >> Final_Score >> Class_Score >> isChairman >> isWestman >> paper;
Student stu(name_tmp, Final_Score, Class_Score, isChairman, isWestman, paper);
if (stumax.Scholarship() < stu.Scholarship())
stumax = stu;
sum += stu.Scholarship();
}
cout << stumax.getName() << endl;
cout << stumax.Scholarship() << endl;
cout << sum << endl;}