1023 Have Fun with Numbers
题意:
大整数与int型整数的乘法;简单哈希。
#include <cstdio> #include <cstring> struct bign{ ]; int len; bign(){ memset(digit,,sizeof(digit)); len=; } }; bign change(char str[]) { bign c; c.len=strlen(str); int n=c.len; ;i<n;i++){ c.digit[i]=str[n--i]-'; } return c; } bign multiply(bign a,int b) { bign c; ; ;i<a.len;i++){ int temp=a.digit[i]*b+carry; c.digit[c.len++]=temp%; carry=temp/; } ){ c.digit[c.len++]=carry%; carry/=; } return c; } void print(bign a) { ;i>=;i--) printf("%d",a.digit[i]); } int main() { ]; scanf("%s",str); ]; memset(hashtable,,sizeof(hashtable)); int len=strlen(str); ;i<len;i++) hashtable[str[i]-']++; bign a=change(str); bign double_a=multiply(a,); ;i<double_a.len;i++) hashtable[double_a.digit[i]]--; bool flag=true; ;i<;i++){ ) { flag=false; break; } } if(flag==true) printf("Yes\n"); else printf("No\n"); print(double_a); ; }
1023 Have Fun with Numbers的更多相关文章
- PAT 1023 Have Fun with Numbers
1023 Have Fun with Numbers (20 分) Notice that the number 123456789 is a 9-digit number consisting ...
- PAT 甲级 1023 Have Fun with Numbers(20)(思路分析)
1023 Have Fun with Numbers(20 分) Notice that the number 123456789 is a 9-digit number consisting exa ...
- PAT 1023 Have Fun with Numbers[大数乘法][一般]
1023 Have Fun with Numbers (20)(20 分) Notice that the number 123456789 is a 9-digit number consistin ...
- pat 1023 Have Fun with Numbers(20 分)
1023 Have Fun with Numbers(20 分) Notice that the number 123456789 is a 9-digit number consisting exa ...
- PAT 甲级 1023 Have Fun with Numbers (20 分)(permutation是全排列题目没读懂)
1023 Have Fun with Numbers (20 分) Notice that the number 123456789 is a 9-digit number consisting ...
- 1023 Have Fun with Numbers (20 分)
1023 Have Fun with Numbers (20 分) Notice that the number 123456789 is a 9-digit number consisting ...
- PAT (Advanced Level) Practice 1023 Have Fun with Numbers (20 分) 凌宸1642
PAT (Advanced Level) Practice 1023 Have Fun with Numbers (20 分) 凌宸1642 题目描述: Notice that the number ...
- 1023 Have Fun with Numbers (20)(20 point(s))
problem Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 t ...
- PTA (Advanced Level) 1023 Have Fun with Numbers
Have Fun with Numbers Notice that the number 123456789 is a 9-digit number consisting exactly the nu ...
- PAT 甲级 1023 Have Fun with Numbers
https://pintia.cn/problem-sets/994805342720868352/problems/994805478658260992 Notice that the number ...
随机推荐
- JNI_Z_01_获取Clazz
1. 为了能够在C/C++中使用Java类,jni.h头文件中专门定义了jclass类型来表示Java中的Class类(ZC: 就是Clazz) 2. 2.1.JNIEXPORT void JNICA ...
- ArcGIS API For Silverlight使用在线地图的多种方法总结
引自:http://www.cnblogs.com/meimao5211/p/3283969.html ArcGIS API For Silverlight使用在线地图的多种方法总结 本人也正在学习A ...
- 五十一 Python分布式爬虫打造搜索引擎Scrapy精讲—scrapyd部署scrapy项目
scrapyd模块是专门用于部署scrapy项目的,可以部署和管理scrapy项目 下载地址:https://github.com/scrapy/scrapyd 建议安装 pip3 install s ...
- 第七届蓝桥杯C-B-10-最大比例/gcd变形
最大比例 X星球的某个大奖赛设了M级奖励.每个级别的奖金是一个正整数.并且,相邻的两个级别间的比例是个固定值.也就是说:所有级别的奖金数构成了一个等比数列.比如:16,24,36,54其等比值为:3/ ...
- JS前端重点 -- Generator 函数的含义与用法
Generator 函数的含义与用法 1.generator http://www.ruanyifeng.com/blog/2015/04/generator.html http://it.taocm ...
- 33-THREE.JS 圆柱体
<!DOCTYPE html> <html> <head> <title></title> <script src="htt ...
- LeetCode OJ:Longest Palindromic Substring(最长的回文字串)
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...
- 【python】numpy pandas 特性(随时更新)
[value map] 用df.replace(dict)可以解决.但是如果dict太大,会非常非常慢. [array相加的维度规律][广播] (2,3) 能和 (3,) 相加,不能和(2,)相加 ( ...
- Visual Studio 2013中用VSIX创建项目模版
我会一步一步解释: 我的一个项目里有5个工程, 我想用其中的4个去创建一个新的工具模版,我还想把他们都放到一个文件夹下面当我用这个模版创建新的工程时.注意我的初始化项目,我想把他们转换成一个模版(我不 ...
- 1 秒杀系统模拟基础实现,使用DB实现
本文根据动脑学院的一节类似的课程,改编实现.分别使用DB和redis来完成. 隔离的解释 业务隔离:将秒杀业务独立出来,尽量不与其他业务关联,以减少对其他业务的依赖性.譬如秒杀业务只保留用户id,商品 ...