mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 100819R.cpp
This commit is contained in:
parent
be702512ae
commit
b6207d5be8
42
Codeforces/Gym/100819R.cpp
Normal file
42
Codeforces/Gym/100819R.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/// Problem R - Class Time
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
#define NAMELEN 128
|
||||
#define MAXN 105
|
||||
struct _student
|
||||
{
|
||||
char a[NAMELEN];
|
||||
char b[NAMELEN];
|
||||
};
|
||||
_student stu[MAXN];
|
||||
|
||||
bool cmp(const _student& sta,const _student& stb)
|
||||
{
|
||||
int a=strcmp(sta.b,stb.b);
|
||||
if(a==0)
|
||||
{
|
||||
int b=strcmp(sta.a,stb.a);
|
||||
return (b<0);
|
||||
}
|
||||
return (a<0);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%s %s",stu[i].a,stu[i].b);
|
||||
}
|
||||
sort(stu,stu+n,cmp);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
printf("%s %s\n",stu[i].a,stu[i].b);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user