Big question ..
# Include <iostream> # include <algorithm> # include <cstdio> # include <string> using namespace STD; int change (string temp) // convert the input temp to numbers 1, 2, 10 {If (temp. size () = 0) {return 0;} If (temp. compare ("I") = 0) {return 1;} If (temp. compare ("II") = 0) {return 2;} If (temp. compare ("III") = 0) {return 3;} If (temp. compare ("IV") = 0) {return 4;} If (temp. compare ("v") = 0) {return 5;} If (temp. compare ("Vi") = 0) {return 6;} If (temp. compare ("VII") = 0) {return 7;} If (temp. compare ("VIII") = 0) {return 8;} If (temp. compare ("IX") = 0) {return 9;} If (temp. compare ("X") = 0) {return 10 ;}} int main () {int total; CIN> total; while (total --) {string Roman; cin> Roman; int ans; If (Roman. size ()> = 1 & Roman [0] = 'l') {cout <"50" <Endl; continue;} If (Roman. size ()> = 2 & Roman [0] = 'X' & Roman [1] = 'l') {ans = 40; string T (Roman, 2, Roman. size ()-2); ans + = change (t); cout <ans <Endl; continue;} If (Roman. size ()> = 3 & Roman [0] = 'X' & Roman [1] = 'X' & Roman [2] = 'X ') {ans = 30; string T (Roman, 3, Roman. size ()-3); ans + = change (t); cout <ans <Endl; continue;} If (Roman. size ()> = 2 & Roman [0] = 'X' & Roman [1] = 'X') {ans = 20; string T (Roman, 2, Roman. size ()-2); ans + = change (t); cout <ans <Endl; continue;} If (Roman. size ()> = 1 & Roman [0] = 'X') {ans = 10; string T (Roman, 1, Roman. size ()-1); ans + = change (t); cout <ans <Endl; continue;} cout <change (Roman) <Endl ;} return 0 ;}