markdown 在线制作ppt json校验和格式化工具

POJ 2121

  1 #include <iostream>
  2 #include <string>
  3 using namespace std;
  4 
  5 int main()
  6 {
  7     //freopen("acm.acm","r",stdin);
  8     char c;
  9     string s;
 10     int sum;
 11     int tem;
 12     int k = 1;
 13     sum = 0;
 14     tem = 0;
 15     bool cmp(string a,string b);
 16     string max;
 17     max = "no";
 18     while(cin>>s)
 19     {
 20         if(s == "negative")
 21         {
 22             k *= -1;
 23         }
 24         else if(s == "one")
 25         {
 26             tem += 1;
 27         }
 28         else if(s == "two")
 29         {
 30             tem += 2;
 31         }
 32         else if(s == "three")
 33         {
 34             tem += 3;
 35         }
 36         else if(s == "four")
 37         {
 38             tem += 4;
 39         }
 40         else if(s == "five")
 41         {
 42             tem += 5;
 43         }
 44         else if(s == "six")
 45         {
 46             tem += 6;
 47         }
 48         else if(s == "seven")
 49         {
 50             tem += 7;
 51         }
 52         else if(s == "eight")
 53         {
 54             tem += 8;
 55         }
 56         else if(s == "nine")
 57         {    
 58             tem += 9;
 59         }
 60         else if(s == "ten")
 61         {
 62             tem += 10;
 63         }
 64         else if(s == "eleven")
 65         {
 66             tem += 11;
 67             //tem = 0;
 68         }
 69         else if(s == "twelve")
 70         {
 71             tem += 12;
 72         //    tem = 0;
 73         }
 74         else if(s == "thirteen")
 75         {
 76             tem += 13;
 77         }
 78         else if(s == "fourteen")
 79         {
 80             tem += 14;
 81         }
 82         else if(s == "fifteen")
 83         {
 84             tem += 15;
 85         }
 86         else if(s == "sixteen")
 87         {
 88             tem += 16;
 89         }
 90         else if(s == "seventeen")
 91         {
 92             tem += 17;
 93         }
 94         else if(s == "eighteen")
 95         {
 96             tem += 18;
 97         }
 98         else if(s == "nineteen")
 99         {
100             tem += 19;
101         }
102         else if(s == "twenty")
103         {
104             tem += 20;
105         }
106         else if(s == "thirty")
107         {
108             tem += 30;
109         }
110         else if(s == "forty")
111         {
112             tem += 40;
113         }
114         else if(s == "fifty")
115         {
116             tem += 50;
117         }
118         else if(s == "sixty")
119         {
120             tem += 60;
121         }
122         else if(s == "seventy")
123         {
124             tem += 70;
125         }
126         else if(s == "eighty")
127         {
128             tem += 80;
129         }
130         else if(s == "ninety")
131         {
132             tem += 90;
133         }
134         else if(s == "hundred")
135         {
136             //sum += tem*100;
137             //tem = 0;
138             //max = s;
139             tem *= 100;
140         }
141         else if(s == "thousand")
142         {
143             tem *= 1000;
144             sum += tem;
145             tem = 0;
146         }
147         else if(s == "million")
148         {
149         
150             tem *= 1000000;
151             sum += tem;
152             tem = 0;
153         }
154         c = getchar();
155         if(c == '\n')
156         {
157             cout<<k*(sum+tem)<<endl;
158             sum = 0;
159             tem = 0;
160             k = 1;
161         }
162     }
163 }

 

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。 

技术网站地址: vmfor.com

posted @ 2015-06-10 17:04  GavinHacker  阅读(213)  评论(0编辑  收藏  举报
markdown 在线制作ppt json校验和格式化工具