网站做链接的意义是什么意思,医院图书馆网站建设的意义,对网站建设的维护,国内永久免费的crm系统软件solution
判断现有数字是否全为个位数 全为个位数#xff0c;找出出现次数最多的数字#xff0c;并首行输出最多出现次数#xff0c;第二行输出所有出现该次数的数值不全为个位数 若当前位数值为0#xff0c;无需处理若当前位数值非0#xff0c;则每位立方相乘#xff0…
solution
判断现有数字是否全为个位数 全为个位数找出出现次数最多的数字并首行输出最多出现次数第二行输出所有出现该次数的数值不全为个位数 若当前位数值为0无需处理若当前位数值非0则每位立方相乘并把结果个位和相加更新为当前位新数值
#includeiostream
using namespace std;
int n1, n2, flag[10] {0}, a[1001], maxn -1, judge 0, first 1, d;
int main(){scanf(%d%d, n1, n2);for(int i n1; i n2; i){a[i] i;}if(n2 9) judge 1;while(judge){judge 0;for(int i n1; i n2; i){int t1 1, t2 0, t a[i];if(t 0) continue;while(t){d t % 10;t / 10;t1 * d * d * d;}while(t1){d t1 % 10;t1 / 10;t2 d;}a[i] t2;if(t2 9) judge 1;}}for(int i n1; i n2; i){flag[a[i]];}for(int i 0; i 10; i){if(flag[i] maxn) maxn flag[i];}printf(%d\n, maxn);for(int i 0; i 10; i){if(flag[i] maxn){if(first) first 0;else printf( );printf(%d, i);}}return 0;
} or
#includeiostream
using namespace std;
int n1, n2, flag[10] {0}, a[1001], maxn -1, judge 0, first 1, d;
int main(){scanf(%d%d, n1, n2);for(int i n1; i n2; i) a[i] i;if(n2 9) judge 1;while(judge){judge 0;for(int i n1; i n2; i){int t1 1, t2 0, t a[i];if(t 0) continue;while(t){d t % 10;t / 10;t1 * d * d * d;}while(t1){d t1 % 10;t1 / 10;t2 d;}a[i] t2;if(t2 9) judge 1;}}for(int i n1; i n2; i){flag[a[i]];if(flag[a[i]] maxn) maxn flag[a[i]];}printf(%d\n, maxn);for(int i 0; i 10; i){if(flag[i] maxn){if(first) first 0;else printf( );printf(%d, i);}}return 0;
}