1016. 部分A+B

 1 /*
 2  * Main.c
 3  * 1016. 部分A+B
 4  *  Created on: 2014年8月30日
 5  *      Author: Boomkeeper
 6  *******测试通过*********
 7  */
 8
 9 #include <stdio.h>
10 #include <math.h>
11
12 int main(void){
13
14     long a,b;
15     int Da,Db;
16     int Pa=0,Pb=0;
17     int count_a=0,count_b=0;//计数Da、Db个数
18     int i;
19
20     scanf("%ld %i %ld %i",&a,&Da,&b,&Db);
21
22     while(a!=0){
23         if(a%10==Da)
24             count_a++;
25         a/=10;
26     }
27     while(b!=0){
28         if(b%10==Db)
29             count_b++;
30         b/=10;
31     }
32
33     for(i=count_a-1;i>=0;i--){
34         Pa+=Da*pow(10,i);
35     }
36
37     for(i=count_b-1;i>=0;i--){
38         Pb+=Db*pow(10,i);
39     }
40
41     printf("%d\n",Pa+Pb);
42
43     return 0;
44 }

题目链接:

http://pat.zju.edu.cn/contests/pat-b-practise/1016

.

时间: 2024-08-07 18:35:32

1016. 部分A+B的相关文章

【BZOJ】【1016】【JSOI2008】最小生成树计数

Kruskal/并查集+枚举 唉我还是too naive,orz Hzwer 一开始我是想:最小生成树删掉一条边,再加上一条边仍是最小生成树,那么这两条边权值必须相等,但我也可以去掉两条权值为1和3的,再加上权值为2和2的,不也满足题意吗?事实上,如果这样的话……最小生成树应该是1和2,而不是1和3或2和2!!! 所以呢?所以对于一个图来说,最小生成树有几条边权为多少的边,都是固定的!所以我们可以做一遍Kruskal找出这些边权,以及每种边权出现的次数.然后,对于每种边权,比方说出现了$v_i$

FOJ Problem 1016 无归之室

 Problem 1016 无归之室 Accept: 926    Submit: 7502Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 金字塔中有一个房间名叫"无归之室".房间地面完全由相同的矩形瓷砖覆盖.房间里布满无数的机关和陷阱,这正是其名字的由来.考古队花了几年时间研究对策,最后他们想出了一个方案.一台遥控的机器人将被送入房间,解除所有机关,然后返回.为了不触动机关,机器人必须走在瓷砖

Error Domain=com.alamofire.error.serialization.response Code=-1016 &quot;Request failed: unacceptabl

在使用AFNetworking 2.0  的时候本来一切很顺畅,但是中途遇到几个比较坑的地方 这里分享一下爬坑经历,忘读者不能速爬坑! 在发送请求后,NSURLSessionDataTask一直报错 Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" AFURLResponseSerializat

MYSQL导出报错mysqldump: Got error: 1016:

公司有一个内部论坛数据库,比较小1G左右,版本是MySQL 5.1,在导出数据库时报错如下: [[email protected] ~]# mysqldump -uroot -p xxxx > xxxxx Enter password:  mysqldump: Got error: 1016: Can't open file: './xxxxxx' (errno: 24) when using LOCK TABLES 根据资料,当MySQL open_file_limit设置低于MySQL打开的

BZOJ 1016 最小生成树计数

Description 现在给出了一个简单无向加权图.你不满足于求出这个图的最小生成树,而希望知道这个图中有多少个不同的最小生成树.(如果两颗最小生成树中至少有一条边不同,则这两个最小生成树就是不同的).由于不同的最小生成树可能很多,所以你只需要输出方案数对31011的模就可以了. Input 第一行包含两个数,n和m,其中1<=n<=100; 1<=m<=1000; 表示该无向图的节点数和边数.每个节点用1~n的整数编号.接下来的m行,每行包含两个整数:a, b, c,表示节点a

HDU 1016 Prime Ring Problem 题解

Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle should always be 1

[ACM] 1016 Prime Ring Problem (深度优先搜索)

Prime Ring Problem Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle

题目1016:火星A+B(进制新问题)

题目链接:http://ac.jobdu.com/problem.php?pid=1016 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: // // 1016 火星A+B.cpp // Jobdu // // Created by PengFei_Zheng on 28/04/2017. // Copyright © 2017 PengFei_Zheng. All rights reserved. // #include <stdi

Error Domain=com.alamofire.error.serialization.response Code=-1016 &quot;Request failed: unacceptable content-type: text/html&quot; 的问题原因及解决方案

Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html",此问题的原因就是使用的第三方框架AFNetworking 接口返回值类型不确定,由于服务器人员习惯于使用html文件所以将json文件也这么写了,导致没法解析 在模型类或者网络工具类中添加这句代码就能完美解决上述问题,建议不要直接修改AFNetw

1016. Phone Bills (25)——PAT (Advanced Level) Practise

题目信息: 1016. Phone Bills (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending