美文网首页
URAL_1219 Symbolic Sequence

URAL_1219 Symbolic Sequence

作者: 我什么都不知道呀 | 来源:发表于2015-10-19 20:29 被阅读25次

标签: URAL

题目连接

思路

分割成三个一组的基本节,从aaazzz,循环输出知道1000,000个字母

代码

// original from http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27798
#include<cstdio>
int main() {
  for (int n = 1000000;;) {
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < 26; j++) {
        for (int k = 0; k < 26; k++) {
          if (n-- > 0) printf("%c", 'a' + i);
          if (n-- > 0) printf("%c", 'a' + j);
          if (n-- > 0) printf("%c", 'a' + k);
          else return 0;
        }
      }
    }
  }

  return 0;
}

相关文章

网友评论

      本文标题:URAL_1219 Symbolic Sequence

      本文链接:https://www.haomeiwen.com/subject/kkizcttx.html