B题要套一个数论的模版,注意m=1!! C题可以二分匹配,把行列看作点; 不能开百度,开谷歌搜题解,再次强调!一经发现,取消成绩!
ECJTU_ACM 11级队员2012年暑假训练赛(8)
4:30:00
FAQ | About Virtual Judge | | | All Copyright Reserved ©2010-2012 TEAM Anything about the OJ, please ask in the , or contact author: Server Time: 2012-08-13 10:52:34
1 // Project name : G 2 // File name : main.cpp 3 // Author : iCoding 4 // E-mail : honi.linux@gmail.com 5 // Date & Time : Fri Aug 10 15:24:28 2012 6 7 8 #include9 #include 10 #include 11 #include 12 #include 13 using namespace std;14 15 /*************************************************************************************/16 /* data */17 18 19 /*************************************************************************************/20 /* procedure */21 22 23 /*************************************************************************************/24 /* main */25 int main()26 {27 string s;28 while (cin >> s)29 {30 int count = 0;31 int top = s.length() - 1;32 for (int i = 0; i <= top; i++)33 {34 if (s[i] == '4' || s[i] == '7')35 {36 count++;37 }38 }39 40 //cout << count << endl;41 42 bool yes = true;43 if (count == 0)44 {45 yes = false;46 }47 while (yes == true && count)48 {49 if (count % 10 == 4 || count % 10 == 7)50 {51 count /= 10;52 }53 else54 {55 yes = false;56 }57 }58 59 if (yes)60 {61 cout << "YES" << endl;62 }63 else64 {65 cout << "NO" << endl;66 }67 }68 return 0;69 }70 71 // end 72 // Code by Sublime text 273 // iCoding@CodeLab