C/C++の宿題片付けます 130代目
■ このスレッドは過去ログ倉庫に格納されています
0583デフォルトの名無しさん
2009/09/30(水) 22:48:27#include<stdio.h>
void turi(long value, long unit, long foo, const char *bar){
int i;
if(unit<=0) return;
if(value/unit){
for(i=value/unit;i;i--) printf("%c", *bar);
}
turi(value%unit, unit/foo, (foo==2)?5:2, bar+1);
}
int main(void){
long value;
scanf("%ld", &value);
turi(value, 1000, 2, "MDCLXVI");
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています