10 2024 档案

摘要:#include <bits/stdc++.h> #define ll long long using namespace std; int main() { // 读取输入的字符串 string s; cin >> s; // 初始化有效性标志为1(有效) int f = 1; // 定义年、月、 阅读全文
posted @ 2024-10-31 15:45 行胜于言Ibl 阅读(34) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main(){ string a,b; //字符串可能空格,所以使用扫描一整行的方式 getline(cin,a); getline(cin,b); int cnt=0; //统计结果 for(int 阅读全文
posted @ 2024-10-31 15:41 行胜于言Ibl 阅读(29) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; int main() { string s; cin>>s; cout<<s<<endl;//先输出原字符串 for(int i=0; i<s.size(); i++) 阅读全文
posted @ 2024-10-31 15:39 行胜于言Ibl 阅读(34) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main() { string a,b; cin>>a>>b; //利用字符串的比较函数 if(a.compare(b)<=0){ cout<<a<<b; }else{ cout<<b<<a; } re 阅读全文
posted @ 2024-10-31 15:37 行胜于言Ibl 阅读(31) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ string a,b; getline(cin,a); getline(cin,b); //将字符串中所有的字母均转换为小写字母 for(int i=0;i<a.size();i++) 阅读全文
posted @ 2024-10-31 15:27 行胜于言Ibl 阅读(27) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main(){ string a,b; //字符串可能空格,所以使用扫描一整行的方式 getline(cin,a); getline(cin,b); bool f = 0;//1代表是子串,0代表不是 阅读全文
posted @ 2024-10-31 15:21 行胜于言Ibl 阅读(31) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #define ll long long using namespace std; int main() { string s; cin>>s; //利用双指针的方式,L指向第一个字符,R指向最后一个字符 //f标记,0代表不是回文,1代表室回文 i 阅读全文
posted @ 2024-10-31 15:19 行胜于言Ibl 阅读(21) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main() { string s; cin>>s; cout<<s; //先输出原字符串 s[0]-=32; //首字母变大写 cout<<s; //再输出新的单词 return 0; } 阅读全文
posted @ 2024-10-31 15:17 行胜于言Ibl 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #define ll long long using namespace std; int main() { string s1,s2; getline(cin,s1); getline(cin,s2); //准备两个字符串,把原本字符串空格去掉后存 阅读全文
posted @ 2024-10-31 15:15 行胜于言Ibl 阅读(18) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin,s); for(int i=0;i<s.size();i++){ //检查到“,”就结束遍历 if(int(s[i])==','){ bre 阅读全文
posted @ 2024-10-31 15:14 行胜于言Ibl 阅读(30) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n; cin>>n; int maxn=-1;//记录最大的分数 string ans; //记录分数最高学生姓名 while(n- 阅读全文
posted @ 2024-10-31 15:13 行胜于言Ibl 阅读(23) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin,s); cout<<s; char a; a=s[0]; //把第一个字符先存起来 s[0]=s[s.length()-1]; //把第一 阅读全文
posted @ 2024-10-31 15:12 行胜于言Ibl 阅读(28) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #define ll long long using namespace std; //利用桶标记的概念 int a[26]; // a[0]代表字母a出现的次数,a[1]代表b...以此类推 int main() { string s; cin>> 阅读全文
posted @ 2024-10-31 15:09 行胜于言Ibl 阅读(32) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; /* double b = 3.1415926535 C++的保留小数 fixed << setprecision(小数位数)<<要保留小数的变量或表达式 fixed 阅读全文
posted @ 2024-10-31 15:07 行胜于言Ibl 阅读(50) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #define ll long long using namespace std; int main() { string s; getline(cin,s); cout<<s.size()<<endl; int cnt=0; for(int i=0 阅读全文
posted @ 2024-10-31 15:06 行胜于言Ibl 阅读(44) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; int main(){ //长度不相等:1234567 5267 长度长的数字大 string a,b; cin>>a>>b; if(a.size()!=b.size( 阅读全文
posted @ 2024-10-31 15:05 行胜于言Ibl 阅读(23) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; char maxn[51],t[51]; //先输入第一个单词 cin>>maxn; n--; //数量-1 while(n--){ cin>>t; / 阅读全文
posted @ 2024-10-31 15:02 行胜于言Ibl 阅读(35) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main(){ string a,b; //字符串可能空格,所以使用扫描一整行的方式 getline(cin,a); getline(cin,b); //把a字符串变成长的 if(a.size()<b. 阅读全文
posted @ 2024-10-31 14:59 行胜于言Ibl 阅读(38) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; ll a[31][31]; //a[i][j]代表i行j列的分母 int n,m; int main(){ cin>>n>>m; //第一列分母是 1/i for(int i=1;i<=n;i++){ a[i] 阅读全文
posted @ 2024-10-30 17:33 行胜于言Ibl 阅读(50) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; /* 用一个n行m列的二维数组,记录每个的路线 第一行第一列 每个点的路线都是1 之外所有的点的路线数量 = 上方+左方 */ long long a[101][101]; //a[i][j]代表到达i行j列的 阅读全文
posted @ 2024-10-30 17:27 行胜于言Ibl 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; long long a[1001][1001]; int n; int main(){ cin>>n; long long ans = -1;//记录最大结果 //开始递推每一个位置的最大值 for(int i 阅读全文
posted @ 2024-10-30 17:24 行胜于言Ibl 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; /* 用一个n行m列的二维数组,记录每个的路线 第一行第一列 每个点的路线都是1 之外所有的点的路线数量 = 上方+左方 */ long long a[21][21]; //a[i][j]代表到达i行j列的路线 阅读全文
posted @ 2024-10-30 17:23 行胜于言Ibl 阅读(26) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; long long a[21][21]; int n,m; int main(){ cin>>n>>m; //初始化第一行 for(int i=1;i<=m;i++){ a[1][i] = 1; // 初始化行 阅读全文
posted @ 2024-10-30 17:21 行胜于言Ibl 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include<iomanip> //浮点数需要用到的头文件 using namespace std; int main() { //输入圆的半径 double r; cin>>r; //圆的直径 = 半径*2 //圆的周长 = 直径 * π //圆的面积 阅读全文
posted @ 2024-10-23 15:50 行胜于言Ibl 阅读(22) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include<iomanip> //浮点数需要用到的头文件 using namespace std; int main() { //输入半圆的直径 double l; cin>>l; //分析:半圆的直径刚好等于三角形的底 //把右边的弧形阴影移到左边,刚 阅读全文
posted @ 2024-10-23 15:46 行胜于言Ibl 阅读(18) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include<iomanip> //浮点数需要用到的头文件 using namespace std; int main() { //输入一个浮点数 double b; cin>>b; //保留12位小数 cout<<fixed<<setprecision( 阅读全文
posted @ 2024-10-23 15:41 行胜于言Ibl 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include<iomanip> //浮点数需要用到的头文件 using namespace std; int main() { //输入一个浮点数 double b; cin>>b; //保留3位小数 cout<<fixed<<setprecision(3 阅读全文
posted @ 2024-10-23 15:40 行胜于言Ibl 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include<iomanip> //浮点数需要用到的头文件 using namespace std; int main() { //输入两个正方形的边长:题目需要保留小数,所以用double double m,n; cin>>m>>n; //计算空白部分的 阅读全文
posted @ 2024-10-23 15:38 行胜于言Ibl 阅读(21) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> #include<iomanip> using namespace std; int main(){ //输入一个浮点数 double b; cin>>b; //把这个浮点数赋值给一个整数,结果只会保留整数部分 int a = b; //输出整数部分 cout< 阅读全文
posted @ 2024-10-23 15:31 行胜于言Ibl 阅读(22) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main() { //1、创建char类型的变量保存两个字符信号 char a,b; cin>>a>>b; //2、解密第一个信号 a-=5; //解密第二个信号 b+=4; //3、输出解密之后的信号内容 c 阅读全文
posted @ 2024-10-23 15:30 行胜于言Ibl 阅读(36) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //输入一个字符 char c; cin>>c; //加减32,可以实现字母大小写转换 //小转大:-32 //大转小:+32 c=c+32; //输出结果 cout<<c; return 0; 阅读全文
posted @ 2024-10-23 15:29 行胜于言Ibl 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //输入一个字符 char c; cin>>c; //加减32,可以实现字母大小写转换 //小转大:-32 //大转小:+32 c=c-32; //输出结果 cout<<c; return 0; 阅读全文
posted @ 2024-10-23 15:28 行胜于言Ibl 阅读(18) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ char c; //创建一个字符变量c cin>>c; // 输入一个字符,记录在c变量中 //加减0,不会改变本身的大小,但是显示的类型会变成整数,也就是ASCII码 cout<<c-0; re 阅读全文
posted @ 2024-10-23 15:26 行胜于言Ibl 阅读(20) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //接收题目输入的秒数 int n; cin>>n; //输入样例:6218秒 //一分钟:60秒 //一个小时的秒数 :60*60=3600秒 //小时:6218/3600 = 1小时....2 阅读全文
posted @ 2024-10-23 15:25 行胜于言Ibl 阅读(36) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main() { //输入一个两位数 int n; cin>>n; //求出个位和十位 int ge = n%10; int shi = n/10; //输出相加的结果 cout<<ge+shi; return 阅读全文
posted @ 2024-10-23 15:22 行胜于言Ibl 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main() { //输入两个整数,保存在两个变量a和b中 int a,b; cin>>a>>b; //交换两个变量的值需要借助一个临时变量作为中介 int t = a; //先把a记录出来 a=b; //把b的 阅读全文
posted @ 2024-10-23 15:21 行胜于言Ibl 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main() { //输入长方形的长和宽 int l,w; cin>>l>>w; //输出:周长 面积 cout<<(l+w)*2<<" "<<l*w; return 0; } 阅读全文
posted @ 2024-10-23 15:18 行胜于言Ibl 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main() { //输入一个三位数 int n; cin>>n; //取出个十百位 int ge = n%10; int shi = n/10%10; int bai = n/10/10; //把三位数倒过来: 阅读全文
posted @ 2024-10-23 15:16 行胜于言Ibl 阅读(17) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main() { //输入年、月、日 int y,m,d; cin>>y>>m>>d; //按照格式输出 cout<<y<<"-"<<m<<"-"<<d; return 0; } 阅读全文
posted @ 2024-10-23 15:14 行胜于言Ibl 阅读(61) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //输入一个两位数 int n; cin>>n; //获取个位和十位的数字 int ge = n%10; int shi = n/10; //交换位置输出 //个位变成十位:个位*10 //十位变 阅读全文
posted @ 2024-10-23 15:12 行胜于言Ibl 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //输入两个整数 int a,b; cin>>a>>b; //按照格式输出结果 cout<<a<<"+"<<b<<"="<<a+b; return 0; } 阅读全文
posted @ 2024-10-23 15:10 行胜于言Ibl 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main() { //输出 cout //输出运算符 << //换行 endl //注意不是打自己的名字噢 cout<<"My name is Tong Tong."<<endl; cout<<"I am 9 阅读全文
posted @ 2024-10-23 15:02 行胜于言Ibl 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main() { //输出 cout //输出运算符 << //换行 endl cout<<" ***** "<<endl; cout<<" ******* "<<endl; cout<<"*********" 阅读全文
posted @ 2024-10-23 15:01 行胜于言Ibl 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main() { //输出 cout //输出运算符 << //换行 endl cout<<" * "<<endl; cout<<" *** "<<endl; cout<<"*****"<<endl; retu 阅读全文
posted @ 2024-10-23 14:59 行胜于言Ibl 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int main(){ //输出 cout //输出运算符 << //换行 endl cout<<"*****"<<endl; cout<<"*"<<endl; cout<<"*****"<<endl; cout<<"* 阅读全文
posted @ 2024-10-23 14:57 行胜于言Ibl 阅读(68) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; int main() { string a; while(cin>>a){ //cin输入会有返回 char c = a[0]; //取出第一个字符 if(c>'Z') 阅读全文
posted @ 2024-10-22 19:54 行胜于言Ibl 编辑

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