题解 | #明明的随机数#

字符串分隔

http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7

我的做法是先补足再遍历

using System;
using System.Linq;

namespace App {
public class Test {
    public static void Main() {
        string input;
        while ((input = Console.ReadLine()) != null) {
            int length = input.Length;
            int lack = 8 - length % 8;
            if (lack > 0 && lack < 8) {
                for (int i = 0; i < lack; i++) {
                    input += "0";
                }
            }
            int lineNum = input.Length / 8;
            for (int j = 0; j < lineNum; j++) {
                string curLineStr = input.Substring(8 * j, 8);
                Console.WriteLine(curLineStr);
            }
        }
        return;
    }
}
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 11:16
点赞 评论 收藏
分享
机械打工仔:我来告诉你原因,是因为sobb有在线简历,有些HR为了快会直接先看在线简历,初步感觉不合适就不会找你要详细的了
投了多少份简历才上岸
点赞 评论 收藏
分享
仁者伍敌:牛子这些人还会点一个自动回复,boss都不带回复的
点赞 评论 收藏
分享
评论
4
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务