- cjkpublic's blog
一本通参考题解©C.J.K.
- 2023-5-19 10:48:37 @
P
P
C++
//Written by liwenfang(Very Handsome)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b; //定义两个整型变量a,b
cin>>a>>b; //依次输入a,b
cout<<a+b; //输出a与b的和
return 0; //表示结束程序
}
Python
#Written by liwenfang(Very Handsome)
a,b=map(int,input().split()) #输入一行,断开成两部分后分别转为整型赋值给变量a,b
print(a+b) #输出a与b的```
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
cout<<"Hello,World!"; //输出指定字符串
return 0;
}
Python
print("Hello,World!") #打印指定字符串
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c; //定义变量
cin>>a>>b>>c; //输入变量
cout<<b; //输出指定变量
return 0;
}
Python
a,b,c=map(int,input().split()) #输入
print(b) #输出
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;
printf("%8d %8d %8d",a,b,c);
//或cout<<setw(8)<<a<<' '<<setw(8)<<b<<' '<<setw(8)<<c;
}
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
char a;
cin>>a;
printf(" %c\n %c%c%c\n%c%c%c%c%c",a,a,a,a,a,a,a,a,a);
/*
或cout<<" "<<a<<endl
<<" "<<a<<a<<a<<endl
<<a<<a<<a<<a<<a<<endl;
*/
return 0;
}
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,x,y,b;
double z;
cin>>x>>a>>y>>b;
z=1.0*(b*y-a*x)/(b-a);
printf("%.2lf",z);
return 0;
}
P
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin>a>>b>>c;
cout<<(a+b)*c; //YBT1007
//cout<<(a+b)/c; //YBT1008
return 0;
}
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
cout<<a/b<<' '<<a%b;
return 0;
}
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
//cout<<fixed<<setprecision(9)<<1.0*a/b;
printf("%.9f",1.0*a/b);
return 0;
}
P
C++
#include <bits/stdc++.h>
using namespace std;
int main() {
double a,b;
cin>>a>>b;
printf("%.3f%%",b/a*100);
return 0;
}