摘要: include<iostream>#include<cstdio>#include<string> #pragma warning(disable : 4996) #define NUM 100 //数组 using namespace std; string weekday[] = { "mond 阅读全文
posted @ 2022-02-12 14:25 江南王小帅 阅读(27) 评论(0) 推荐(0)
摘要: //数组//接受键盘输入的100个整数,然后将它们按照和原顺序相反的顺序输出//用数组 #include<iostream>#include<cstdio>#pragma warning(disable : 4996) #define NUM 100 using namespace std; int 阅读全文
posted @ 2022-02-12 14:08 江南王小帅 阅读(173) 评论(0) 推荐(0)
摘要: //求阶乘的和//即1!+2!+3!+...n! using namespace std; int main() { int n, sum=0; cin >> n; for (int i = 1; i <= n; i++) { int factorial=1; //存放i阶乘 factorial * 阅读全文
posted @ 2022-02-12 11:20 江南王小帅 阅读(36) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>#pragma warning(disable : 4996) //求阶乘的和//即1!+2!+3!+...n! using namespace std; int main() { int n, sum=0; cin >> n; f 阅读全文
posted @ 2022-02-12 11:16 江南王小帅 阅读(76) 评论(0) 推荐(0)
摘要: //斐波那契数列//输入第k项,输出数列值 using namespace std; int main() { int a1 = 1, a2 = 1;//a1是倒数第二项,a2是最后一项 int k; cin >> k; if (k==1 || k==2) { cout << 1 << endl; 阅读全文
posted @ 2022-02-12 10:45 江南王小帅 阅读(50) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>#pragma warning(disable : 4996) //乘方计算using namespace std; int main() { int a, n; cin >> a >> n; int result = 1; for 阅读全文
posted @ 2022-02-12 09:39 江南王小帅 阅读(104) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>#pragma warning(disable : 4996) //freopen 重定向输入//调试程序是,每次运行程序都需要输入测试数据,太麻烦//可以将测试数据存储文件,然后用freopen将输入由键盘重定向为文件//则运行程 阅读全文
posted @ 2022-02-12 09:33 江南王小帅 阅读(53) 评论(0) 推荐(0)
摘要: /读入若干个正整数 输出其中的最大值//处理无结束标记的OJ题目的输入 //连续按三次ctrl + z,并且每次^z都要在每行的首列!可以退出输入 using namespace std; int main() { int n, mx = 0; while (scanf("%d",&n)!=EOF) 阅读全文
posted @ 2022-02-12 09:10 江南王小帅 阅读(63) 评论(0) 推荐(0)