USACO Section 2.2: Preface Numbering

搬了leetcode的代码

 /*
 ID: yingzho1
 LANG: C++
 TASK: preface
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>

 using namespace std;

 ifstream fin("preface.in");
 ofstream fout("preface.out");

 int N;
 ] = {'I', 'V', 'X', 'L', 'C', 'D', 'M'};

 string intToRoman(int num) {
     ;
     string ret;
     ; i >= ; i -= ) {
         int digit = num / scale;
         ) {
             ) ret = ret + string(digit, symbol[i]);
             ) ret = ret + symbol[i] + symbol[i+];
             ) ret = ret + symbol[i+];
             ) ret = ret + symbol[i+] + , symbol[i]);
             ) ret = ret + symbol[i] + symbol[i+];
         }
         num %= scale;
         scale /= ;
     }
     return ret;
 }

 int main()
 {
     fin >> N;
     map<char, int> res;
     ; i <= N; i++) {
         string s = intToRoman(i);
         ; j < s.size(); j++) {
             res[s[j]]++;
         }
     }
     ; i < ; i++) {
         ) fout << symbol[i] << " " << res[symbol[i]] << endl;
     }

     ;
 }
上一篇:Java awt组件间的继承关系


下一篇:解决界面有搜索栏时,点击TableView的空白界面,键盘不消失的问题