2013年7月13日

Codeforces Round #189 (Div. 2) 解题报告

摘要: ----------------A. Magic Numbers一个神奇的数字是由1、14、144连接而成的,判断一个数字是不是神奇数字。----①没有连续3个以上的4。②首位不能为4。数据范围太大,最好按字符读入。#include #include #include using namespace std; char c; int n,num; bool flag; int main() { flag=true; num=0; n=0; while (cin>>c) { if (n==0&&c!='1') { ... 阅读全文

posted @ 2013-07-13 20:17 电子幼体 阅读(184) 评论(0) 推荐(0) 编辑

Topcoder SRM 583 DIV2 解题报告

摘要: -----------------250SwappingDigits给一个数字串,要求交换两个数字的位置得到一个尽可能小的数字。(可以不交换)----从高位向低位枚举,对每一位,从低位向高位找一个比它小的数,若能找到则交换即答案。对首位不能为0进行特殊处理。#include #include #include using namespace std; class SwappingDigits{ private: public: string minNumber(string num) { int n=num.le... 阅读全文

posted @ 2013-07-13 17:45 电子幼体 阅读(233) 评论(0) 推荐(0) 编辑

导航