梵墨 @ 2019-11-06 12:56:18
蒟蒻80求助
#include<iostream>
#include<cstdio>
#include<windows.h>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<queue>//队列
#include<stack>//栈
#include<ctime>
using namespace std;
int n,b,c;
struct node{
int h,z,a;
};
node p[310];
bool cmp(node a1,node a2){
return a1.z>a2.z;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
p[i].h=i;
cin>>p[i].a>>b>>c;
p[i].z=p[i].a+b+c;
}
sort(p+1,p+n+1,cmp);
for(int i=1;i<=n;i++){
if(p[i].z==p[i+1].z&&p[i].a<p[i+1].a){
swap(p[i].z,p[i+1].z);
swap(p[i].a,p[i+1].a);
swap(p[i].h,p[i+1].h);
}
else if(p[i].z==p[i+1].z&&p[i].a==p[i+1].a&&p[i].h>p[i+1].h){
swap(p[i].z,p[i+1].z);
swap(p[i].a,p[i+1].a);
swap(p[i].h,p[i+1].h);
}
}
for(int i=1;i<=5;i++){
cout<<p[i].h<<" "<<p[i].z<<endl;
}
return 0;
}
by JasonZRY @ 2019-11-06 13:05:29
@梵墨
码风新奇
by 梵墨 @ 2019-11-06 13:09:46
@JasonZRY 您指的是代码空行吗?我首次发帖,不会排版……
by 梵墨 @ 2019-11-06 13:20:29
谢谢大佬,不过我自己重新敲出来了
(感觉有点像暴力出奇迹)
#include<cstdio>
int n,m,f[220][10];
int main()
{
scanf("%d%d",&n,&m);
int i,j;
for(i=1;i<=n;i++)f[i][1]=1;
for(i=1;i<=n;i++)
for(j=2;j<=m;j++)
f[i][j]=f[i-1][j-1]+(i>=j?f[i-j][j]:0);
printf("%d\n",f[n][m]);
return 0;
}
by sky_di @ 2019-11-06 13:25:24
用冒泡不行吗 QwQ
by sky_di @ 2019-11-06 13:25:44
差点以为你这是抄的a.a
by 梵墨 @ 2020-06-02 13:02:10
@sky_di 呃呃呃,不是啊