#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
struct node
{
char name[90],place[90];
int num;
}c[105];
bool cmp(node x,node y)
{
if(strcmp(x.place,y.place)<0) return true;
if(strcmp(x.place,y.place)==0&&strcmp(x.name,y.name)<0) return true;
return false;
}
int main()
{
int test,n;
scanf("%d",&test);
while(test–)
{
memset(&c,0,sizeof(&c));
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s %s %d",c[i].name,c[i].place,&c[i].num);
sort(c,c+n,cmp);
for(int i=0;i<n;i++){
if(strcmp(c[i].place,c[i+1].place)==0)
{
if(strcmp(c[i].name,c[i+1].name)==0)
c[i+1].num+=c[i].num,c[i].num=0;
}
else
{
printf("%s
",c[i].place);
for(int j=0;j<n;j++)
{
if(strcmp(c[i].place,c[j].place)==0&&c[j].num)
printf(" |—-%s(%d)
",c[j].name,c[j].num);
}
}
#include <string.h>
#include <algorithm>
using namespace std;
struct node
{
char name[90],place[90];
int num;
}c[105];
bool cmp(node x,node y)
{
if(strcmp(x.place,y.place)<0) return true;
if(strcmp(x.place,y.place)==0&&strcmp(x.name,y.name)<0) return true;
return false;
}
int main()
{
int test,n;
scanf("%d",&test);
while(test–)
{
memset(&c,0,sizeof(&c));
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s %s %d",c[i].name,c[i].place,&c[i].num);
sort(c,c+n,cmp);
for(int i=0;i<n;i++){
if(strcmp(c[i].place,c[i+1].place)==0)
{
if(strcmp(c[i].name,c[i+1].name)==0)
c[i+1].num+=c[i].num,c[i].num=0;
}
else
{
printf("%s
",c[i].place);
for(int j=0;j<n;j++)
{
if(strcmp(c[i].place,c[j].place)==0&&c[j].num)
printf(" |—-%s(%d)
",c[j].name,c[j].num);
}
}
}
if(test!=0)
printf("
");
}
return 0;
}
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » hdu 1263 水果 sort对结构体中字符串二级排序
波比源码 » hdu 1263 水果 sort对结构体中字符串二级排序
order levaquin 250mg online cheap buy levaquin generic
acheter gГ©nГ©rique cialis en france cialis 40mg sans ordonnance en pharmacie sildenafil en ligne
buspar over the counter cordarone 100mg pill order ditropan without prescription
cialis next day delivery phenazopyridine order symmetrel 100 mg sale
order zithromax 250mg pill order azithromycin 500mg pill order neurontin 100mg pills
buy cialis 40mg generic order tadalafil 20mg online cheap buy generic sildenafil
order sporanox for sale tinidazole cost purchase tinidazole for sale
norvasc usa viagra 50mg uk buy cialis 20mg online cheap
tadalafil for sale online buy viagra tablets sildenafil 50mg
flomax pill order zofran 4mg without prescription order spironolactone online cheap
brand simvastatin 10mg order valacyclovir 500mg generic finasteride without prescription
brand flagyl order metronidazole pill brand trimethoprim
keflex 500mg usa order cephalexin online cheap order erythromycin for sale
order sildenafil 50mg pill viagra 50mg cost generic tadalafil 40mg
play slots casino online blackjack cialis next day delivery usa
order furosemide 100mg online cost furosemide hydroxychloroquine tablet
terbinafine uk order suprax 100mg order amoxicillin 500mg generic
order naproxen 500mg generic order prevacid 15mg lansoprazole pill
cialis coupon walmart buy ed pills sale order cialis 10mg online
nifedipine 10mg cheap perindopril 8mg drug allegra order online
order ramipril generic purchase arcoxia generic order generic etoricoxib
custom research paper writing need help writing a paper order sulfasalazine 500 mg without prescription
purchase asacol for sale irbesartan 300mg us irbesartan 150mg over the counter
fosamax 70mg us purchase ibuprofen generic purchase ibuprofen sale
priligy 90mg ca brand dapoxetine 90mg purchase domperidone pills
order nortriptyline online cheap nortriptyline over the counter order paroxetine 20mg online cheap
oral pepcid 20mg pepcid us order remeron
order doxycycline 100mg generic brand doxycycline 200mg methylprednisolone 8 mg oral
tadacip 20mg oral amoxicillin 250mg cost buy amoxicillin 250mg online
tadalafil without prescription Cialis store order generic sildenafil 50mg
tadalafil uk cialis canada best ed pill for diabetics
order generic minocycline 100mg buy hytrin online cheap buy hytrin 1mg pills
provigil over the counter generic stromectol 6mg purchase promethazine pill
buy deltasone 20mg generic buy accutane amoxicillin 250mg us
clomid order online order prednisolone 20mg prednisolone 20mg drug
order sildenafil 100mg sildenafil order online order proscar 5mg
buy generic isotretinoin 10mg purchase prednisone generic acillin us
zofran 8mg over the counter order zofran without prescription generic trimethoprim
buy albuterol online cheap synthroid order generic augmentin
isotretinoin 40mg ca zithromax 250mg pill order zithromax generic
buy provigil 200mg generic lopressor 100mg generic order metoprolol 50mg generic
prednisolone 20mg canada order prednisolone 10mg lasix 100mg pill
order azathioprine 50mg order naproxen 500mg buy naprosyn 500mg generic
order generic doxycycline 200mg levitra 10mg drug acyclovir 800mg ca