- 博客(11)
- 收藏
- 关注
原创 Matlab 计算激光速率方程
两种方法,一个是使用matlab内嵌ode45函数,一个是使用数值迭代的方法。1.常规的三能级激光系统速率方程表示如下:{dN3 dt=N1W13−N3(S32+A31)dN2 dt=−(N2−g2g1N1)σ21vϕ−N2(A21+S21)+N3S32N1+N2+N3=NTdϕdt=(N2−g2g1N1)σ21vϕ−ϕτL\left\{\begin{aligned}\frac{\mathrm{d} N_{3}}{\mathrm{~d} t}&=N_{1} W_{13
2022-04-14 22:23:02
5474
7
原创 1011 A+B 和 C (C++)
1没什么好说的,常规的输入输出,值得注意的一点就是,输入参数的取值范围。#include<iostream>using namespace std;int main(){ int n; long a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a + b > c) cout << "Case .
2021-05-24 21:05:21
209
原创 1010 一元多项式求导(C++)
1.未全对#include<iostream>using namespace std;int main(){ int a[2001], n = 0; do { cin >> a[n++]; } while (getchar() != '\n'); for (int i = 0; i < n; i = i + 2) { a[i] = a[i] * a[i + 1]; a[i + 1] = a[i + 1] - 1; } for (int i .
2021-05-19 17:03:20
231
原创 1009 反说话(C++)
#include<iostream>#include<string>using namespace std;int main(){ string str[80]; int n = 0; do { cin >> str[n++]; } while (getchar() != '\n'); n--; for (; n >= 0; n--) { printf("%s %c", str[n].c_str(), n ? ' ' : '\n').
2021-05-13 19:26:29
186
原创 1008 数组元素循环右移问题 (C++)
方法1:传统循环运动算法#include<iostream>using namespace std;int main(){ int N, M,arr[101],tmp; cin >> N >> M; for (int i = 0; i < N; i++) { cin >> arr[i]; } for (int i = 0; i < M; i++) { tmp = arr[N - 1]; for (int j =.
2021-05-06 14:46:17
366
原创 1007 素数对猜想(C++)
#include<iostream>#include<math.h>using namespace std;int main() { int n,j,k=0,m=0,arr[100000]; cin >> n; //找素数 for (int i = 2; i <= n; i++) { for (j = 2; j <= (int)sqrt(i); j++) { if (i % j == 0) break; } .
2021-04-28 20:59:29
139
原创 1006 换个格式输出(C++)
#include<iostream>using namespace std;int main(){ int a, b, c,n,tmp; cin >> n; a = n /100; tmp = n % 100; b = tmp/10; tmp %= 10; c = tmp; for (int i = 0; i < a; i++) { cout << "B"; } for (int i = 0; i < b; i++) {.
2021-04-28 11:40:34
85
原创 1005继续(3n+1)猜想(C++)
1笨方法没全部正确,不知道为什么,就不贴了。大概思路说一下:就是建立几个数值,将输入值和其覆盖数分别存储,并一一对比,不是关键数的用0赋值,然后排序,输出的时候进行判断,不为0的关键数输出。2利用vector和sort排序#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){ //vector定义和参数输入 int n,tmp; ci.
2021-04-27 21:29:56
199
原创 1004 成绩排名 (C++版)
题目如下#include<iostream>using namespace std;#include<string>//创建学生数据类型:姓名,学会,成绩struct stu{ string name,numb; int score;};int main(){ int n = 0; cin >> n; stu s[10000]; //输入字符串数组 for (int i = 0; i < n; i++) { cin >
2021-04-21 10:32:12
619
原创 1003 我要通过!(C++版)
题目如下:#include<iostream>#include<string>using namespace std;int juage(string str){ int n_p = 0, n_t = 0,n_a=0; for (int j = 0; j < str.length(); j++) { //如果某个字符不是P A T三个字符中的一个,返回0 if (str[j] != 'P' && str[j] != 'T' &
2021-04-18 11:21:55
291
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人