删数问题问题(贪心) 求测试数据(Wrong)
来源:互联网 发布:阁和楼的区别 知乎 编辑:程序博客网 时间:2024/06/15 00:07
/*日期:2011-10-20
作者:xiaosi
题目: 删数问题问题(贪心)
*/
#include<iostream>
#include<cstdio>
#include<stdlib.h>
using namespace std;
struct Num
{
char num;
int index;
}N[201];
int cmp(const void *a,const void *b)
{
struct Num *c = (Num *)a;
struct Num *d = (Num *)b;
return c->num - d->num;
}
int cmp1(const void *a,const void *b)
{
struct Num *c = (Num *)a;
struct Num *d = (Num *)b;
return c->index - d->index;
}
int main()
{
int i=0;
while(scanf("%c",&N[i].num)!=EOF)
{
int k,l;
N[i].index=0;
while(N[i].num!='\n')
{
i++;
scanf("%c",&N[i].num);
N[i].index=i;
}
l=i;
scanf("%d",&k);
qsort(N,l,sizeof(N[0]),cmp);
qsort(N,l-k,sizeof(N[0]),cmp1);
for(i=0;i<l-k;i++)
{
printf("%c",N[i].num);
}
printf("\n");
i=0;
getchar();
}
return 0;
}
- 删数问题问题(贪心) 求测试数据(Wrong)
- 数列极差问题(贪心) 求数据(一直Wrong)
- 删数问题(贪心)
- 删数问题(贪心)
- 删数问题(贪心)
- 删数问题(贪心问题)
- 算法:(贪心算法)--删数问题
- 【贪心】删数问题
- 【贪心】删数问题
- 贪心 删数问题
- 贪心,删数问题
- [贪心] 删数问题
- 删数问题 贪心
- [贪心]删数问题
- 贪心 -- 删数问题
- 删数问题(贪心问题)SDUT OJ题
- 删数问题(典型的贪心算法问题)
- 删数问题(简单的贪心算法)
- windows 2008server 修改系统的默认远程连接数
- 发送到邮箱
- 随便聊聊
- "在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的。如果在 IIS 中没有将虚拟目录配置为应用程序,则可能导致此错误。"解决方法
- 破解PE文件
- 删数问题问题(贪心) 求测试数据(Wrong)
- (*(volatile unsigned long *)0x0012450的理解
- HDOJ 1150 Machine Schedule
- HDU 2435 There is a war
- IKE协议(因特网密钥交换协议)
- SQL Server 没有日志文件(*.ldf) 只有数据文件(*.mdf) 恢复到SQL Server2005
- 3.20 Data class(纯稚的数据类)
- .net 获取上一周的时间段
- 《Linux那些事儿之我是USB》我是U盘(22)彼岸花的传说(一)