[排序]ZOJ 3501 Roman Order


这个题讲 的就是一个变换
对于给出的一组数字,先把它们对应的罗马数字表示出来,然后根据那些字母按照字母表排序,然后把排好序的输出,OK
额,还有啊,自己挺喜欢这种题的,不过,always写着写着就写不出来了,感觉有好多东西自己不知道,不会用,暂且积累一下这类题把
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4344

#include
#include
#include
#include
using namespace std;
struct node
{
        char v[20];
        int num,len;
}p[10005];

char chg[][5]=
{
    "","I","II","III","IV","V","VI","VII","VIII","IX",
    "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
    "","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
    "","M","MM","MMM"
};
bool cmp(node a,node b)
{
        return strcmp(a.v,b.v)<0;
}

int main()
{
        int cas;
        scanf("%d",&cas);
        while(cas--)
        {
               int n;
               scanf("%d",&n);
               int a;
               for(int i=0; i=0; w--)
                                   p[i].v[j++]=chg[k+ind][w];
                               a/=10;
                               ind+=10;
                       }
                       for(int w=0; w
					

发表评论