【ECJTU_ACM 11级队员2012年暑假训练赛(8) - H - Petya and Strings】
Home | Problems | Status | Contest | Register | Login |
B题要套一个数论的模版,注意m=1!! C题可以二分匹配,把行列看作点; 不能开百度,开谷歌搜题解,再次强调!一经发现,取消成绩!
ECJTU_ACM 11级队员2012年暑假训练赛(8)
4:30:00
FAQ | About Virtual Judge | Forum | Discuss | Open Source Project
All Copyright Reserved ©2010-2012 HUST ACM/ICPC TEAM
Anything about the OJ, please ask in the forum, or contact author:Isun
Server Time:
1 // Project name : H ( Petya and Strings ) 2 // File name : main.cpp 3 // Author : iCoding 4 // E-mail : honi.linux@gmail.com 5 // Date & Time : Fri Aug 10 13:14:48 2012 6 7 8 #include <iostream> 9 #include <stdio.h> 10 #include <string> 11 #include <cmath> 12 #include <algorithm> 13 using namespace std; 14 15 /*************************************************************************************/ 16 /* data */ 17 string sa, sb; 18 19 /*************************************************************************************/ 20 /* procedure */ 21 22 int iCalForResult() 23 { 24 int iTop = sa.length() - 1; 25 for (int i = 0; i <= iTop; i++) 26 { 27 if (sa[i] >= 'A' && sa[i] <= 'Z') 28 { 29 sa[i] += 32; 30 } 31 if (sb[i] >= 'A' && sb[i] <= 'Z') 32 { 33 sb[i] += 32; 34 } 35 } 36 37 int res = 0; 38 for (int i = 0; res == 0 && i <= iTop; i++) 39 { 40 if (sa[i] > sb[i]) 41 { 42 res = 1; 43 } 44 else if (sa[i] < sb[i]) 45 { 46 res = -1; 47 } 48 } 49 return res; 50 } 51 /*************************************************************************************/ 52 /* main */ 53 int main() 54 { 55 while (cin >> sa >>sb) 56 { 57 cout << iCalForResult() << endl; 58 } 59 return 0; 60 } 61 62 // end 63 // Code by Sublime text 2 64 // iCoding@CodeLab