with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a different permutation. Check to see the result if we double it again!
Java import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean right = true; BigInteger b1, b2; b1 = sc.nextBigInteger(); b2 = b1.multiply(new BigInteger("2")); int[] a = new...
permutation: 排列(方式);组合(方式) 通用方法 循环遍历计算结果,拼成字符串 map封装大数字符次数结果,循环比较倍数结果与原数字符个数及种类 不手生的情况下,10分钟内a题 测试用例 input: 1234567899 output: Yes 2469135798 1. 2. 3. 4. 5. ac代码 时间长手生,撸代码时间耗费偏多 #include #include<iostre...
Sample Output: Yes 2469135798 importjava.math.BigInteger;importjava.util.Scanner;publicclassMain{publicstaticbooleanjudge(Stringnums,Stringdoubled){char[]exaclty=newchar[10];if(nums.length()!=doubled.length()){returnfalse;}for(inti=0;i<nums.length();i++){intnum=nums.charAt(i)-'0';exaclty...
(PAT 1023) Have Fun with Numbers (大整数运算) Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9,...
原题链接:数据结构-起步能力自测题 自测-4 Have Fun with Numbers 老规矩,大整数用字符数组,然后找找规律来做。 #include<stdio.h>#include<string.h>intmain(){charch,a[21];inti=0,j,n,b[10]={0};intx,r=0,flag=0,flag2=0;scanf("%s",a);n=strlen(a);charc[n+1];j=n;c[j]='\0...
1023 Have Fun with Numbers (20 分) Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in ...
#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<algorithm>usingnamespacestd;intmain(){#if ONLINE_JUDGE#elsefreopen("input.txt","r",stdin);#endifcharinput[21];scanf("%s",input);strings=input;intnum[10]={0};// 0->9boolisFun=true;for(inti=0;i<s.size()...
7-49 Have Fun with Numbers 作者 陈越 单位 浙江大学 Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to...
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a different permutation. Check to see ...