The input contains a single integer a (1 ≤ a ≤ 30).
Output a single integer.
3
27
思路:
Smith (or joke) numbers:
composite numbers n such that sum of digits of n = sum of digits of prime factors of n (counted with multiplicity).
joke numbers的定义: 如果一个数每一位数字相加的和等于它的所有质因子的每一位数字相加的和,那么这个数定义为joke number.
例如: 27=3*3*3;
27每一位数字相加的和为2+7=9
所有质因子数字相加地和为3+3+3=9
那么27就是一个joke number
前几个joke number:
4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165
代码:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int num[]={0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
int main(){
int a;
scanf("%d",&a);
printf("%d\n",num[a]);
return 0;
}
PS: April Fools Contest:刷新你对自己智商下限的认识。