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 ...
随机推荐
- Java实现的一个小说采集程序
被标题吸引进来的不要骂我. 只是一个简单的实现,随手写了来下载一部喜欢的小说的.示例中的小说只是示例,不是我的菜. 使用了jsoup.挺好用的一个工具. 有需要的话,参考下自己改吧.挺简单的,是吧. ...
- java-四则运算-五-网页版--with刘童格
<%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncodin ...
- HTML5 ——web audio API 音乐可视化(一)
使用Web Audio API可以对音频进行分析和操作,最终实现一个音频可视化程序. 最终效果请戳这里; 完整版代码请戳这里,如果还看得过眼,请给一个start⭐ 一.API AudioContext ...
- 需要记忆的几个sql语句
链接查询: 1.查询两个表,在where中定义连接条件: select student.sno,sname,ssex,sage,sdept,cno,grade. from student,sc whe ...
- 智课雅思词汇---二十六、形容词后缀-ble
智课雅思词汇---二十六.形容词后缀-ble 一.总结 一句话总结: assemble 英 [ə'semb(ə)l] 美 [ə'sɛmbl] vt. 集合,聚集:装配:收集 vi. 集合,聚集 [ ...
- Android TextView 设置滚动条(纯xml)
<ScrollView android:id="@+is/scrollView_id" android:layout_width="fill_parent" ...
- 《Advanced Bash-scripting Guide》学习(一):对一个增强和广义的删除logfile的脚本的理解
本文所选的例子来自于<Advanced Bash-scripting Gudie>一书,译者 杨春敏 黄毅 cleanup:一个增强和广义的删除logfile的脚本 #!/bin/bash ...
- 51nod 1154 dp
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1154 1154 回文串划分 基准时间限制:1 秒 空间限制:131072 ...
- 关键C函数备录
一.搜索指定路径下的文件 (1) intptr_t _findfirst(const char *, struct _finddata_t *);//可以使用通配符*或? (2) int _findn ...
- 【C#】Socket中的ssl通信
引言 有个项目中用到了Socket ssl通信,在此记录一下. 证书 Socket ssl需要用到证书用来校验身份,而作为调试,我们只需用测试证书即可. 有个工具可以很方便地制作测试证书,下载地 ...