题目传送门

 /*
构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
int a[MAXN]; int main(void) //Codeforces Round #206 (Div. 2) A. Vasya and Digital Root
{
//freopen ("A.in", "r", stdin);
int k, d;
while (scanf ("%d%d", &k, &d) == )
{
if (d == && k > ) {puts ("No solution"); continue;}
if (k >= d)
{
for (int i=; i<=d; ++i) putchar ('');
for (int i=; i<=k-d; ++i) putchar ('');
puts ("");
}
else
{
if ( * k < d) {puts ("No solution"); continue;}
for (int i=; i<=k; ++i) a[i] = d / k;
int res = d % k;
for (int i=; i<=res; ++i) a[i]++;
for (int i=; i<=k; ++i) printf ("%d", a[i]);
puts ("");
} } return ;
}

构造水题 Codeforces Round #206 (Div. 2) A. Vasya and Digital Root的更多相关文章

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

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

  2. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  3. 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas

    题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...

  4. 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas

    题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm ...

  5. 水题 Codeforces Round #303 (Div. 2) A. Toy Cars

    题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during th ...

  6. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

  7. 水题 Codeforces Round #306 (Div. 2) A. Two Substrings

    题目传送门 /* 水题:遍历一边先找AB,再BA,再遍历一边先找BA,再AB,两种情况满足一种就YES */ #include <cstdio> #include <iostream ...

  8. 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table

    题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...

  9. 水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest

    题目传送门 /* 水题:开个结构体,rk记录排名,相同的值有相同的排名 */ #include <cstdio> #include <cstring> #include < ...

随机推荐

  1. InfluxDB useful commands

    InfluxDB 配置文件地址:/etc/influxdb/influxdb.conf 通过curl写数据 curl -i -XPOST 'http://localhost:8086/write?db ...

  2. SharePoint中取得ACL和组中用户数量

     SharePoint中取得ACL和组中用户数量 1. 取得ACL的数量: select COUNT(ra.PrincipalId) as [Count],p.ScopeUrl from [WSS_C ...

  3. jquery 动态添加,降低input表单的方法

    html代码例如以下 <html> <tr><button style="margin-left:10px" class="add_fiel ...

  4. USACO castle

    <pre name="code" class="cpp"><pre>USER: Kevin Samuel [kevin_s1] TASK ...

  5. ASP.net MVC+ViewData VS ViewBag

         在使用MVC框架的过程中,往界面传值,我们使用的ViewData.如ITOO部分代码图解:      当然除了ViewData,我们还能够使用同卵兄弟(ViewBag)来完毕相同的功能,详情 ...

  6. python的序列化和反序列化以及json

    python 的序列化和反序列化用于内存之间的共享,包括服务器和客户端的共享,两个Python程序之间的共享,以及以字符串的形式存储到硬盘中. pyhton 的pickle 可以对Python的各种数 ...

  7. Cocos2dx 小技巧(十三)聊聊坐标系

    一好友考上了空姐.她说:以后基本上不会回来了.等下次见面时请叫我白富美!尽管有点羡慕.但我依然不甘示弱回复:下次见面时请叫我高富帅! 未来,谁说得准呢? ------------------有段时间没 ...

  8. 查看android-support-v4.jar引出的问题

    1.前面博文里也写过如何关联android-support-v4.jar的源码 今天新项目用上述方法的时候,竟然不成功..来回反复试了很长时间,最后发现 新建项目,会自动引用一个类库(自动新建的..) ...

  9. (16)ServletContext详解

    1,作用: ServletContext对象 ,叫做Servlet的上下文对象.表示一个当前的web应用环境.一个web应用中只有一                                   ...

  10. tcp与socket关系

    套接字(socket)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元.