2th integer_to_roman
来源:互联网 发布:csgo网络不稳定 编辑:程序博客网 时间:2024/06/05 21:52
#include <iostream>#include <string>#include <cstring>//std::string strroman[]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};class Solution {public: std::string intToRoman(int num) {int i;std::string roman;int value[]={1000,900,500,400,100,90,50,40,10,9,5,4,1}; std::string Roman[ ]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};//char roman[20]; for ( i = 0; num > 0; ++i) { int count; count = num/value[i]; num %= value[i]; for (; count > 0; --count) { roman += Roman[i];} } return roman; }};int main(){ using namespace std; int Integer; //string roman; cout << "Integer: "; Solution integer_to_roman; cin >> Integer ; cout<< "Roman:"<<integer_to_roman.intToRoman(Integer)<<endl; system("pause"); return 0;}
阅读全文
0 0
- 2th integer_to_roman
- Leetcode:integer_to_roman
- leetcode--integer_to_roman && roman_to_integer
- 2th Nov Lab_Log
- 12th_usb(2th)
- 2th roma int
- Th
- th
- linux驱动学习-2th
- 题目2 : K-th string
- GDUFE 2017 2th Monthly
- Core Java2 6th 摘要(2)
- Java SE 15th IO (2)
- effective C++ 3th 备忘2
- 《C++Primer 5th》 读书笔记2--const
- 1585 - Score(lrj3-1,2th)
- Python-F-2- August 8th
- C Primer Plus 5th 2.12.2
- 【 Hibernate4】二级缓存详解
- Java并发编程艺术 8 Java中的并发工具类
- 机房收费系统(四)MDI窗体
- webpack
- XUtils BitmapUtils 源码分析
- 2th integer_to_roman
- c++虚基类
- Python学习笔记 8
- Hibernate缓存详解
- 正则表达式符号大全
- spoj2666 Qtree4(类似于bzoj1095: [ZJOI2007]Hide 捉迷藏)详解
- (十七)bufferevent的管理
- yaf框架的一些函数
- 《C++ Primer Plus》笔记