/*
* c.cpp
*
* Created on: 2013-10-7
* Author: wangzhu
*/ /**
* 当时比赛时,想得复杂了,也想偏了,
* 1)、写出来之后,结果达到了预期的结果,不过和给出的输出不一样,糊涂了
* 2)、想法太复杂了
*
* 比赛之后,看了别人的,原来如此:
*结果不唯一,
*当根为0,但位数大于1,则没有结果,因为位数大于1,最后的根必然大于0,故没有结果;
*当不为0,则应是根后面跟位数减去一个零,即是结果。
*/
#include<cstdio>
#include<iostream>
using namespace std;
int main() {
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
int k,d;
while(~scanf("%d%d",&k,&d)) {
if(d == && ( k > )) {
printf("No solution\n");
} else {
printf("%d",d);
for(int i = ;i < k;i++) {
printf("");
}
printf("\n");
}
}
return ;
}

codeforces Vasya and Digital Root的更多相关文章

  1. 构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root

    题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algori ...

  2. codeforces A. Vasya and Digital Root 解题报告

    题目链接:http://codeforces.com/problemset/problem/355/A 题目意思:找出某个经过最多四次dr(n)操作等于d的k位数.   千万不要想得太复杂,想得越简单 ...

  3. codeforces 355A Vasya and Digital Root

    题意就是找出一个长度为k的整数,使得它的root为d,k的可能取值为1-1000. 第一眼看到这个题,无从下手,想到那么长的数,暴力肯定超时.其实不然,题目要求只要输出任何一个满足条件的即可,因为任何 ...

  4. Codeforces Round #206 (Div. 2) A. Vasya and Digital Root

    #include <iostream> using namespace std; int main(){ int k,d; cin >> k >>d; ) { k ...

  5. Codeforces Beta Round #10 C. Digital Root 数学

    C. Digital Root 题目连接: http://www.codeforces.com/contest/10/problem/C Description Not long ago Billy ...

  6. codeforces 10C Digital Root(非原创)

    Not long ago Billy came across such a problem, where there were given three natural numbers A, B and ...

  7. Digital root(数根)

    关于digital root可以参考维基百科,这里给出基本定义和性质. 一.定义 数字根(Digital Root)就是把一个数的各位数字相加,再将所得数的各位数字相加,直到所得数为一位数字为止.而这 ...

  8. 数字根(digital root)

    来源:LeetCode 258  Add Dights Question:Given a non-negative integer  num , repeatedly add all its digi ...

  9. 【HDOJ】4351 Digital root

    digital root = n==0 ? 0 : n%9==0 ? 9:n%9;可以简单证明一下n = a0*n^0 + a1*n^1 + ... + ak * n^kn%9 = a0+a1+..+ ...

随机推荐

  1. 用于主题检测的临时日志(fe4edac1-b4f4-4673-ae87-110cbb7dbb5a - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

    这是一个未删除的临时日志.请手动删除它.(25ea5485-9168-424b-a30c-09cc1371e2d9 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

  2. nopCommerce的配置以及汉化

    这里给大家一些链接,是关于nopCommerce的一些介绍: nopCommerce的源代码 关于nopcommerce Nopcommerce中文资源 第一步  配置nopCommerce 先上一张 ...

  3. c/c++中const使用总结(金典)

    原文地址:http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777416.html 个人总结:          (1)const只对它左 ...

  4. Java_Vector类的使用,以及Stack继承Vector,推出的栈的特性

    测试用例: import java.util.Stack; /* * 简单的栈类测试: * Stack继承自Vector向量类: * 所以Stack的使用和Vector的使用类型的 * 而且是线程安全 ...

  5. 你所不知道的Html5那些事(一)

    文章简介:       关于html5相信大家早已经耳熟能详,但是他真正的意义在具体的开发中会有什么作用呢?相对于html,他又有怎样的新的定义与新理念在里面呢?为什么一些专家认为html5完全完成后 ...

  6. SimpleDateFormat 的性能和线程安全性

    系统正常运行一段时间后,QA报给我一个异常: java.lang.OutOfMemoryError: GC overhead limit exceeded at java.text.DecimalFo ...

  7. 第五篇、常用的SQL语句和函数介绍

    简介: 在使用到sqlite3的时候,常常需要写一些SQL语句,现将常用到的部分语句稍微总结以下,由于个人习惯,关键字用大写. 附: /*简单约束*/ CREATE TABLE IF NOT EXIS ...

  8. 九度OJ 1362 左旋转字符串(Move!Move!!Move!!!)【算法】

    题目地址:http://ac.jobdu.com/problem.php?pid=1362 题目描述: 汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运 ...

  9. 高并发编程陷阱之check and set

    今天公司CTO跟隔壁部门开技术会,旁听了一下.所讲的内容感觉好高大上啊!简单记录一下 场景是这样的: if(check(id)===true) { }else{ set(id); } 什么意思呢? 就 ...

  10. html分页

    <div class="fy"> <a href="" title="上一页">上一页</a> < ...