05 2023 档案

摘要:卡拉兹(Callatz)猜想: 对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题 阅读全文
posted @ 2023-05-26 22:30 a_true 阅读(31) 评论(0) 推荐(0) 编辑
摘要:L1-003 个位数统计 给定一个 k 位整数 N=dk−1​10k−1+⋯+d1​101+d0​ (0≤di​≤9, i=0,⋯,k−1, dk−1​>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定 N=100311,则有 2 个 0,3 个 1,和 1 个 3。 输入格式: 每个输 阅读全文
posted @ 2023-05-25 23:21 a_true 阅读(27) 评论(0) 推荐(0) 编辑
摘要:本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。 给定任意N个符号, 阅读全文
posted @ 2023-05-24 21:26 a_true 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std; template <typename T>class Node{public: Node(T data) : data(data), next(nullptr) { cout << "Node Constructor r 阅读全文
posted @ 2023-05-23 22:03 a_true 阅读(43) 评论(1) 推荐(0) 编辑
摘要:#include<iostream>#include<list>#include<algorithm>using namespace std;int main(){ int i,a[10],b; for(i=0; i<10; i++){ scanf("%d",&a[i]); } scanf("%d" 阅读全文
posted @ 2023-05-22 22:01 a_true 阅读(20) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(void){ int i,a[10],b; for(i=0; i<10; i++){ scanf("%d",&a[i]); } scan 阅读全文
posted @ 2023-05-19 21:59 a_true 阅读(50) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <string>using namespace std; template <class T>void sort(T *a, int size){ int r, i, j; for(i = 0; i < size; i++) cin >> a[ 阅读全文
posted @ 2023-05-18 19:37 a_true 阅读(81) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std; template <class T> class Absolute { private: T num; public: Absolute(T n) { num = n; } T getValue() const { if 阅读全文
posted @ 2023-05-17 22:43 a_true 阅读(34) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std; template <typename T>T Double(T num){ return 2.0 * num;} int main(void){ char c='\0'; int i=0; long l=0; scanf 阅读全文
posted @ 2023-05-16 21:06 a_true 阅读(25) 评论(0) 推荐(0) 编辑
摘要:大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。 输入格式: 输入第 1 行给出正整数 N(≤105),即双方交锋的次数。随后 N 行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手 阅读全文
posted @ 2023-05-15 19:18 a_true 阅读(159) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include<cmath>using namespace std;//点类Pointclass Point{private: double x; double y;public: Point(double xv=0,double yv=0);/*构造函数*/ 阅读全文
posted @ 2023-05-12 22:30 a_true 阅读(44) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;//点类Pointclass Point{private: double x; double y;public: Point(double xv=0,double yv=0);/*构造函数*/ Point(const Po 阅读全文
posted @ 2023-05-11 21:41 a_true 阅读(39) 评论(0) 推荐(0) 编辑
摘要:给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2 个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的 6174,这个神奇的数字也叫 Kaprekar 常数。 例如,我们从6767开始,将得到 阅读全文
posted @ 2023-05-10 21:32 a_true 阅读(220) 评论(0) 推荐(0) 编辑
摘要:本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。 输入格式: 输入在一行中依次给出 A 和 B,中间以 1 空格分隔。 输出格式: 在一行中依次输出 Q 和 R,中间以 1 空格分隔。 #include 阅读全文
posted @ 2023-05-09 13:54 a_true 阅读(288) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;//点类Pointclass Point{private: double x; double y;public: Point(double xv=0,double yv=0);/*构造函数*/ Point(const Po 阅读全文
posted @ 2023-05-08 18:51 a_true 阅读(89) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include<cmath>using namespace std;//点类Pointclass Point{private: double x; double y;public: Point(double xv=0,double yv=0);/*构造函数*/ 阅读全文
posted @ 2023-05-05 19:43 a_true 阅读(54) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;#define N 100 #include<cstring> class BigNum{private: char num[N];public: BigNum(char c[N] = "+0") { int i,j,a 阅读全文
posted @ 2023-05-04 21:08 a_true 阅读(94) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示