mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-08 02:13:51 +08:00
归类了 OJ,整理了一下
This commit is contained in:
18
XSM OJ 重庆小码王集团OJ/#121. 特殊 a 串数列和.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/#121. 特殊 a 串数列和.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int sum1=0,sum2=0;
|
||||
int a,n;
|
||||
cin >>n>>a;
|
||||
for(int i=0;i<n;i++){
|
||||
sum1=sum1*10+a;
|
||||
sum2+=sum1;
|
||||
}
|
||||
cout <<sum2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
25
XSM OJ 重庆小码王集团OJ/#127. 分离整数的各个数.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/#127. 分离整数的各个数.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c=0,d[10000],i=0;
|
||||
cin >>a;
|
||||
b=a;
|
||||
while(a){
|
||||
a/=10;
|
||||
c++;
|
||||
}
|
||||
while(b){
|
||||
d[i]=b%10;
|
||||
b/=10;
|
||||
i++;
|
||||
}
|
||||
for(int i=0;i<c;i++){
|
||||
cout <<d[i]<<" ";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
25
XSM OJ 重庆小码王集团OJ/#146. 回文数.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/#146. 回文数.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
int sum=0;
|
||||
cin >>a;
|
||||
b=a;
|
||||
while(a){
|
||||
sum=sum*10+a%10;
|
||||
a/=10;
|
||||
}
|
||||
if(b==sum){
|
||||
cout <<"yes";
|
||||
}
|
||||
else{
|
||||
cout <<"no";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
29
XSM OJ 重庆小码王集团OJ/#153. 统计满足条件的4位数.cpp
Normal file
29
XSM OJ 重庆小码王集团OJ/#153. 统计满足条件的4位数.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a[10000],b,c,d,e,f,g=0;
|
||||
cin >>b;
|
||||
for(int i=0;i<b;i++){
|
||||
cin >>a[i];
|
||||
}
|
||||
for(int i=0;i<b;i++){
|
||||
c=a[i]%10;
|
||||
a[i]/=10;
|
||||
d=a[i]%10;
|
||||
a[i]/=10;
|
||||
e=a[i]%10;
|
||||
a[i]/=10;
|
||||
f=a[i]%10;
|
||||
a[i]/=10;
|
||||
if((c-d-e-f)>0){
|
||||
g++;
|
||||
}
|
||||
}
|
||||
cout <<g;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
34
XSM OJ 重庆小码王集团OJ/#209. 矩阵交换行.cpp
Normal file
34
XSM OJ 重庆小码王集团OJ/#209. 矩阵交换行.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a[100][100],b[100][100],c,d;
|
||||
for(int i=0;i<5;i++){
|
||||
for(int j=0;j<5;j++){
|
||||
cin >>a[i][j];
|
||||
}
|
||||
}
|
||||
for(int i=0;i<5;i++){
|
||||
for(int j=0;j<5;j++){
|
||||
b[i][j]=a[i][j];
|
||||
}
|
||||
}
|
||||
cin >>c>>d;
|
||||
for(int i=0;i<5;i++){
|
||||
a[c-1][i]=a[d-1][i];
|
||||
}
|
||||
for(int i=0;i<5;i++){
|
||||
a[d-1][i]=b[c-1][i];
|
||||
}
|
||||
for(int i=0;i<5;i++){
|
||||
for(int j=0;j<5;j++){
|
||||
cout <<a[i][j]<<" ";
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
19
XSM OJ 重庆小码王集团OJ/#228. 统计数字字符个数.cpp
Normal file
19
XSM OJ 重庆小码王集团OJ/#228. 统计数字字符个数.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
int b=0;
|
||||
gets(a);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]>='0' && a[i]<='9'){
|
||||
b++;
|
||||
}
|
||||
}
|
||||
cout <<b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
XSM OJ 重庆小码王集团OJ/#248. 字符串小手术.cpp
Normal file
17
XSM OJ 重庆小码王集团OJ/#248. 字符串小手术.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
char b;
|
||||
cin >>a>>b;
|
||||
cout <<a[0];
|
||||
for(int i=1;i<strlen(a);i++){
|
||||
cout <<b<<a[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
21
XSM OJ 重庆小码王集团OJ/#249. 字符串假肢手术1.cpp
Normal file
21
XSM OJ 重庆小码王集团OJ/#249. 字符串假肢手术1.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000],c;
|
||||
int b;
|
||||
cin >>a>>b>>c;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(i==(b-1)){
|
||||
cout <<c;
|
||||
}
|
||||
else{
|
||||
cout <<a[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
23
XSM OJ 重庆小码王集团OJ/#264. 小码君统计人名字母数.cpp
Normal file
23
XSM OJ 重庆小码王集团OJ/#264. 小码君统计人名字母数.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
int b=0;
|
||||
cin >>a;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]==','){
|
||||
cout <<b<<" ";
|
||||
b=0;
|
||||
}
|
||||
else{
|
||||
b++;
|
||||
}
|
||||
}
|
||||
cout <<b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
27
XSM OJ 重庆小码王集团OJ/#278. 小码君的回文字符串.cpp
Normal file
27
XSM OJ 重庆小码王集团OJ/#278. 小码君的回文字符串.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
cin >>a;
|
||||
int b;
|
||||
int flag=1;
|
||||
for(int i=strlen(a)-1;i>=0;i--){
|
||||
b=strlen(a)-i-1;
|
||||
if(a[i]!=a[b]){
|
||||
flag=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag==1){
|
||||
cout <<"Yes";
|
||||
}
|
||||
else{
|
||||
cout <<"No";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
18
XSM OJ 重庆小码王集团OJ/2个数字的排列.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/2个数字的排列.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=1;i<=a;i++){
|
||||
for(int j=1;j<=a;j++){
|
||||
if(i!=j){
|
||||
cout <<i<<" "<<j<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
16
XSM OJ 重庆小码王集团OJ/2个数字的组合.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/2个数字的组合.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=1;i<=a;i++){
|
||||
for(int j=i+1;j<=a;j++){
|
||||
cout <<i<<" "<<j<<endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/3n+1问题.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/3n+1问题.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b=0;
|
||||
cin >>a;
|
||||
while(a>1){
|
||||
if(a%2==1){
|
||||
a=a*3+1;
|
||||
b++;
|
||||
}
|
||||
if(a%2==0){
|
||||
a=a/2;
|
||||
b++;
|
||||
}
|
||||
}
|
||||
cout <<b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
31
XSM OJ 重庆小码王集团OJ/5新冠病毒初步筛查.cpp
Normal file
31
XSM OJ 重庆小码王集团OJ/5新冠病毒初步筛查.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct wjh{
|
||||
string name;
|
||||
d tw;
|
||||
l ks;
|
||||
}arr[10000];
|
||||
int main(){
|
||||
l cnt=0;
|
||||
l a;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>arr[i].name>>arr[i].tw>>arr[i].ks;
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
if(arr[i].tw>=37.5 && arr[i].ks==1){
|
||||
cout <<arr[i].name<<endl;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
cout <<cnt;
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/B2044 有一门课不及格的学生.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/B2044 有一门课不及格的学生.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c,d=0;
|
||||
cin >>a>>b>>c;
|
||||
if(a>=60){
|
||||
d++;
|
||||
}
|
||||
if(b>=60){
|
||||
d++;
|
||||
}
|
||||
if(c>=60){
|
||||
d++;
|
||||
}
|
||||
if(d==2){
|
||||
cout <<1;
|
||||
}
|
||||
else{
|
||||
cout <<0;
|
||||
}
|
||||
return 0;
|
||||
}
|
6
XSM OJ 重庆小码王集团OJ/Hello World.cpp
Normal file
6
XSM OJ 重庆小码王集团OJ/Hello World.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
cout <<"Hello World";
|
||||
return 0;
|
||||
}
|
3
XSM OJ 重庆小码王集团OJ/README.md
Normal file
3
XSM OJ 重庆小码王集团OJ/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Frederic's Code Repositories
|
||||
|
||||
Hi,作为一名OIer,刷题时难免会遇到代码整理复习的问题,于是我建立了一个Github仓库存放我的代码,也可以供大家参考,谢谢支持!
|
29
XSM OJ 重庆小码王集团OJ/TeX中的引号.cpp
Normal file
29
XSM OJ 重庆小码王集团OJ/TeX中的引号.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[1000];
|
||||
l cnt=0;
|
||||
cin.getline(a,1000);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]=='"' && cnt%2==0){
|
||||
cout <<"``";
|
||||
cnt++;
|
||||
}
|
||||
else if(a[i]=='"' && cnt%2==1){
|
||||
cout <<"''";
|
||||
cnt++;
|
||||
}
|
||||
else{
|
||||
cout <<a[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
30
XSM OJ 重庆小码王集团OJ/hanoi(汉诺塔).cpp
Normal file
30
XSM OJ 重庆小码王集团OJ/hanoi(汉诺塔).cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
void s(char a,char b,char c,int n){
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>a<EFBFBD><61>ʾ<EFBFBD><CABE>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>b<EFBFBD><62>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>c<EFBFBD><63>ʾĿ<CABE><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><6E>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
if(n==1){
|
||||
printf("%c->%c\n",a,c);//<2F>ݹ鵽1<E9B5BD><31><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>ֱ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
||||
return;
|
||||
}
|
||||
s(a,c,b,n-1);//<2F>Ƚ<EFBFBD>n-1<><31> <20><>A<EFBFBD><41>B
|
||||
printf("%c->%c\n",a,c);
|
||||
s(b,a,c,n-1);//<2F>ٽ<EFBFBD>n-1<><31> <20><>B<EFBFBD><42>C
|
||||
}
|
||||
int main(){
|
||||
char a,b,c;
|
||||
int d;
|
||||
cin >>d>>a>>b>>c;
|
||||
s(a,b,c,d);
|
||||
return 0;
|
||||
}
|
14
XSM OJ 重庆小码王集团OJ/sssss...n 的积.cpp
Normal file
14
XSM OJ 重庆小码王集团OJ/sssss...n 的积.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int sum;
|
||||
cin >>a;
|
||||
for(sum=1;a>0;a--){
|
||||
sum*=a;
|
||||
}
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
55
XSM OJ 重庆小码王集团OJ/「7-1」A、队列的基本操作.cpp
Normal file
55
XSM OJ 重庆小码王集团OJ/「7-1」A、队列的基本操作.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
string b;
|
||||
queue<int> que;
|
||||
int main(){
|
||||
freopen("A.in","r",stdin);
|
||||
freopen("A.out","w",stdout);
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>b;
|
||||
if(b=="push"){
|
||||
int x;
|
||||
cin >>x;
|
||||
que.push(x);
|
||||
}
|
||||
else if(b=="front" && que.empty()==0){
|
||||
cout <<que.front()<<endl;
|
||||
}
|
||||
else if(b=="front" && que.empty()==1){
|
||||
cout <<"error"<<endl;
|
||||
}
|
||||
else if(b=="pop" && que.empty()==0){
|
||||
que.pop();
|
||||
}
|
||||
else if(b=="pop" && que.empty()==1){
|
||||
cout <<"error"<<endl;
|
||||
}
|
||||
else if(b=="empty"){
|
||||
if(que.empty()==1){
|
||||
cout <<"empty"<<endl;
|
||||
}
|
||||
if(que.empty()==0){
|
||||
cout <<"not empty"<<endl;
|
||||
}
|
||||
}
|
||||
else if(b=="clear"){
|
||||
while(que.empty()!=true){
|
||||
que.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
18
XSM OJ 重庆小码王集团OJ/「NOIP 2002 普及组」级数求和.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/「NOIP 2002 普及组」级数求和.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
double a,sum=0;
|
||||
int b=0;
|
||||
scanf("%lf",&a);
|
||||
while(sum<=a){
|
||||
b++;
|
||||
sum+=1*1.0/b;
|
||||
}
|
||||
printf("%d",b);
|
||||
return 0;
|
||||
}
|
22
XSM OJ 重庆小码王集团OJ/「NOIP 2010 普及组」数字统计.cpp
Normal file
22
XSM OJ 重庆小码王集团OJ/「NOIP 2010 普及组」数字统计.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,sum=0;
|
||||
scanf("%d%d",&a,&b);
|
||||
for(int i=a;i<=b;i++){
|
||||
int c=i;
|
||||
while(c){
|
||||
if(c%10==2){
|
||||
sum++;
|
||||
}
|
||||
c/=10;
|
||||
}
|
||||
}
|
||||
printf("%d",sum);
|
||||
return 0;
|
||||
}
|
27
XSM OJ 重庆小码王集团OJ/「NOIP 2011 Day 1」铺地毯.cpp
Normal file
27
XSM OJ 重庆小码王集团OJ/「NOIP 2011 Day 1」铺地毯.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
int n,x,y;
|
||||
int a[10005];
|
||||
int b[10005];
|
||||
int g[10005];
|
||||
int k[10005];
|
||||
using namespace std;
|
||||
int main(){
|
||||
cin >>n;
|
||||
for(int i=0;i<n;i++){
|
||||
cin >>a[i]>>b[i]>>g[i]>>k[i];
|
||||
}
|
||||
cin >>x>>y;
|
||||
for(int i=n-1;i>=0;i--){
|
||||
if(x>=a[i] && x<=a[i]+g[i] && y>=b[i] && y<=b[i]+k[i]){
|
||||
cout <<i+1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
cout <<"-1";
|
||||
return 0;
|
||||
}
|
17
XSM OJ 重庆小码王集团OJ/「NOIP 2015普及组」金币.cpp
Normal file
17
XSM OJ 重庆小码王集团OJ/「NOIP 2015普及组」金币.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b=1,sum=0;
|
||||
cin >>a;
|
||||
while(a>b){
|
||||
sum+=b*b;
|
||||
a-=b;
|
||||
b++;
|
||||
}
|
||||
sum+=b*a;
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
26
XSM OJ 重庆小码王集团OJ/「例题1-4」鸡兔同笼.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/「例题1-4」鸡兔同笼.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b;
|
||||
cin >>a>>b;
|
||||
long long flag=0;
|
||||
for(int i=0;i<=a;i++){
|
||||
for(int j=0;j<=a;j++){
|
||||
if(i*2+j*4==b && i+j==a){
|
||||
cout <<i<<" "<<j;
|
||||
}
|
||||
else{
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag==(a+1)*(a+1)){
|
||||
cout <<"No answer";
|
||||
}
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/「程序3-2」开灯问题.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/「程序3-2」开灯问题.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c[100000];
|
||||
cin >>a>>b;
|
||||
for(int i=1;i<=a;i++){
|
||||
c[i]=0;
|
||||
}
|
||||
for(int i=2;i<=b;i++){
|
||||
for(int j=1;j<=a;j++){
|
||||
if(j%i==0){
|
||||
c[j]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=1;i<=a;i++){
|
||||
if(c[i]%2==0){
|
||||
cout <<i<<" ";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
24
XSM OJ 重庆小码王集团OJ/【模板】快速排序.cpp
Normal file
24
XSM OJ 重庆小码王集团OJ/【模板】快速排序.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
int arr[10000000];
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>arr[i];
|
||||
}
|
||||
sort(arr,arr+a);
|
||||
for(int i=0;i<a;i++){
|
||||
cout <<arr[i]<<" ";
|
||||
}
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/三整数排序(2).cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/三整数排序(2).cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c,n;
|
||||
cin >>a>>b>>c;
|
||||
if(a>b){
|
||||
n=a;
|
||||
a=b;
|
||||
b=n;
|
||||
}
|
||||
if(b>c){
|
||||
n=b;
|
||||
b=c;
|
||||
c=n;
|
||||
}
|
||||
if(a>b){
|
||||
n=a;
|
||||
a=b;
|
||||
b=n;
|
||||
}
|
||||
cout <<a<<" "<<b<<" "<<c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
37
XSM OJ 重庆小码王集团OJ/三整数排序.cpp
Normal file
37
XSM OJ 重庆小码王集团OJ/三整数排序.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c;
|
||||
cin >>a>>b>>c;
|
||||
if(a<=b && a<=c){
|
||||
cout <<a<<" ";
|
||||
}
|
||||
else if(b<=a && b<=c){
|
||||
cout <<b<<" ";
|
||||
}
|
||||
else if(c<=a && c<=b){
|
||||
cout <<c<<" ";
|
||||
}
|
||||
if((a>=c && a<=b) || (a<=c && a>=b)){
|
||||
cout <<a<<" ";
|
||||
}
|
||||
else if((b>=c && b<=a) || (b<=c && b>=a)){
|
||||
cout <<b<<" ";
|
||||
}
|
||||
else if((c>=a && a<=b) || (c<=a && c>=b)){
|
||||
cout <<c<<" ";
|
||||
}
|
||||
if(a>=b && a>=c){
|
||||
cout <<a;
|
||||
}
|
||||
else if(b>=a && b>=c){
|
||||
cout <<b;
|
||||
}
|
||||
else if(c>=b && c>=a){
|
||||
cout <<c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
27
XSM OJ 重庆小码王集团OJ/三角形判断.cpp
Normal file
27
XSM OJ 重庆小码王集团OJ/三角形判断.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
cin >>a>>b>>c;
|
||||
if(a<b+c && b<a+c && c<b+a){
|
||||
if(a==b && a==c && b==c){
|
||||
cout <<"<EFBFBD>ȱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if(a==b || a==c || b==c){
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else if(pow(a,2)+pow(b,2)==pow(c,2)){
|
||||
cout <<"ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else{
|
||||
cout <<"һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
}
|
||||
else{
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
return 0;
|
||||
}
|
15
XSM OJ 重庆小码王集团OJ/三角形组成判断.cpp
Normal file
15
XSM OJ 重庆小码王集团OJ/三角形组成判断.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
cin >>a>>b>>c;
|
||||
if(a<b+c && b<a+c && c<b+a){
|
||||
cout <<"yes";
|
||||
}
|
||||
else{
|
||||
cout <<"no";
|
||||
}
|
||||
return 0;
|
||||
}
|
19
XSM OJ 重庆小码王集团OJ/不与指定整数相同的数字之和.cpp
Normal file
19
XSM OJ 重庆小码王集团OJ/不与指定整数相同的数字之和.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n,m,b=0;
|
||||
int a[10000];
|
||||
cin >>n;
|
||||
for(int i=0;i<n;i++){
|
||||
cin >>a[i];
|
||||
}
|
||||
cin >>m;
|
||||
for(int i=0;i<n;i++){
|
||||
if(a[i]==m){
|
||||
b++;
|
||||
}
|
||||
}
|
||||
cout <<b;
|
||||
return 0;
|
||||
}
|
||||
|
35
XSM OJ 重庆小码王集团OJ/不及格的人(结构体).cpp
Normal file
35
XSM OJ 重庆小码王集团OJ/不及格的人(结构体).cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct wjh{
|
||||
string name;
|
||||
int score;
|
||||
}arr[10000];
|
||||
int main(){
|
||||
int a;
|
||||
int flag=0;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>arr[i].name>>arr[i].score;
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
if(arr[i].score>=60){
|
||||
|
||||
}
|
||||
else{
|
||||
cout <<arr[i].name<<endl;
|
||||
flag=1;
|
||||
}
|
||||
}
|
||||
if(flag==0){
|
||||
cout <<"Good!";
|
||||
}
|
||||
return 0;
|
||||
}
|
18
XSM OJ 重庆小码王集团OJ/与指定数字相同的数的个数.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/与指定数字相同的数的个数.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b[1000],c,sum=0;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>b[i];
|
||||
}
|
||||
cin >>c;
|
||||
for(int i=0;i<a;i++){
|
||||
if(b[i]==c){
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/世界末日.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/世界末日.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
void wjh(int x,int n){
|
||||
if(n<x-1){
|
||||
return;
|
||||
}
|
||||
cout <<n<<" ";
|
||||
wjh(x,n-1);
|
||||
}
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
wjh(1,a);
|
||||
return 0;
|
||||
}
|
8
XSM OJ 重庆小码王集团OJ/两位数反转.cpp
Normal file
8
XSM OJ 重庆小码王集团OJ/两位数反转.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >> a;
|
||||
cout <<a%10<<a/10;
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/买书.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/买书.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b[10000],c,d[10000];
|
||||
cin >>a;
|
||||
int sum=0;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>b[i];
|
||||
}
|
||||
cin >>c;
|
||||
for(int i=0;i<c;i++){
|
||||
cin >>d[i];
|
||||
}
|
||||
for(int i=0;i<c;i++){
|
||||
for(int j=0;j<d[i];j++){
|
||||
sum+=b[j];
|
||||
}
|
||||
cout <<sum<<" ";
|
||||
sum=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
13
XSM OJ 重庆小码王集团OJ/买木板.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/买木板.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b;
|
||||
scanf("%d%d",&a,&b);
|
||||
printf("һ<EFBFBD><EFBFBD>%dԪ<64><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%dԪ",a*20,b-a*20);
|
||||
return 0;
|
||||
}
|
18
XSM OJ 重庆小码王集团OJ/二维数字排列.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/二维数字排列.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a;
|
||||
int b;
|
||||
cin >>a;
|
||||
cin >>b;
|
||||
for(int i=b;i>=1;i--){
|
||||
for(int j=1;j<=b;j++){
|
||||
cout <<a<<" ";
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
13
XSM OJ 重庆小码王集团OJ/人口增长问题.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/人口增长问题.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b;
|
||||
cin >>a>>b;
|
||||
return 0;
|
||||
}
|
||||
//https://search.bilibili.com/all?vt=25685816&keyword=minecraft%E7%BD%91%E9%A1%B5%E7%89%88%E6%95%99%E7%A8%8B
|
16
XSM OJ 重庆小码王集团OJ/优美数.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/优美数.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
if(a>50){
|
||||
cout <<"yes";
|
||||
}
|
||||
else if(a%2==0){
|
||||
cout <<"yes";
|
||||
}
|
||||
else{
|
||||
cout <<"no";
|
||||
}
|
||||
return 0;
|
||||
}
|
20
XSM OJ 重庆小码王集团OJ/位运算符.cpp
Normal file
20
XSM OJ 重庆小码王集团OJ/位运算符.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c,d,e,f,g,h;
|
||||
cin >>a>>b;
|
||||
c=a&b;
|
||||
d=a|b;
|
||||
e=a^b;
|
||||
f=~a;
|
||||
cout <<"a&b="<<c<<endl;
|
||||
cout <<"a|b="<<d<<endl;
|
||||
cout <<"a^b="<<e<<endl;
|
||||
cout <<"~a="<<f<<endl;
|
||||
cout <<"a<<b="<<(a<<b)<<endl;
|
||||
cout <<"a>>b="<<(a>>b)<<endl;
|
||||
return 0;
|
||||
}
|
34
XSM OJ 重庆小码王集团OJ/你的飞碟在这儿.cpp
Normal file
34
XSM OJ 重庆小码王集团OJ/你的飞碟在这儿.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[1000],b[1000];
|
||||
l a1[1000],b1[1000],sum1=1,sum2=1;
|
||||
cin >>a>>b;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
a1[i]=a[i]-64;
|
||||
}
|
||||
for(int i=0;i<strlen(b);i++){
|
||||
b1[i]=b[i]-64;
|
||||
}
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
sum1*=a1[i];
|
||||
}
|
||||
for(int i=0;i<strlen(b);i++){
|
||||
sum2*=b1[i];
|
||||
}
|
||||
if(sum1%47==sum2%47){
|
||||
cout <<"GO";
|
||||
}
|
||||
else{
|
||||
cout <<"STAY";
|
||||
}
|
||||
return 0;
|
||||
}
|
22
XSM OJ 重庆小码王集团OJ/分段函数.cpp
Normal file
22
XSM OJ 重庆小码王集团OJ/分段函数.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
double a;
|
||||
cin >>a;
|
||||
if(0<=a && a<5){
|
||||
cout <<fixed<<setprecision(3)<<(0-a)+2.5;
|
||||
}
|
||||
if(5<=a && a<10){
|
||||
cout <<fixed<<setprecision(3)<<2-1.5*(a-3.0)*(a-3.0);
|
||||
}
|
||||
if(10<=a && a<20){
|
||||
cout <<fixed<<setprecision(3)<<a/2.0-1.5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
16
XSM OJ 重庆小码王集团OJ/分离整数的各个数.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/分离整数的各个数.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
long long a;
|
||||
scanf("%lld",&a);
|
||||
while(a){
|
||||
printf("%lld ",a%10);
|
||||
a/=10;
|
||||
}
|
||||
return 0;
|
||||
}
|
13
XSM OJ 重庆小码王集团OJ/判断数字的奇偶.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/判断数字的奇偶.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >> a;
|
||||
if(a%2==0){
|
||||
cout <<"even";
|
||||
}
|
||||
else{
|
||||
cout <<"odd";
|
||||
}
|
||||
return 0;
|
||||
}
|
16
XSM OJ 重庆小码王集团OJ/判断数字的正负.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/判断数字的正负.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
if(a<0){
|
||||
cout <<"negative";
|
||||
}
|
||||
if(a==0){
|
||||
cout <<"zero";
|
||||
}
|
||||
if(a>0){
|
||||
cout <<"positive";
|
||||
}
|
||||
return 0;
|
||||
}
|
20
XSM OJ 重庆小码王集团OJ/判断数正负.cpp
Normal file
20
XSM OJ 重庆小码王集团OJ/判断数正负.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
if(a>0){
|
||||
cout <<"positive";
|
||||
}
|
||||
if(a==0){
|
||||
cout <<"zero";
|
||||
}
|
||||
if(a<0){
|
||||
cout <<"negative";
|
||||
}
|
||||
return 0;
|
||||
}
|
18
XSM OJ 重庆小码王集团OJ/判断正整数位数.cpp
Normal file
18
XSM OJ 重庆小码王集团OJ/判断正整数位数.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b=0;
|
||||
cin >>a;
|
||||
if(a==0){
|
||||
cout <<"1";
|
||||
return 0;
|
||||
}
|
||||
while(a){
|
||||
a/=10;
|
||||
b++;
|
||||
}
|
||||
|
||||
cout <<b;
|
||||
return 0;
|
||||
}
|
||||
|
14
XSM OJ 重庆小码王集团OJ/判断素数.cpp
Normal file
14
XSM OJ 重庆小码王集团OJ/判断素数.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b=0;
|
||||
cin >>a;
|
||||
for(int i=2;i*i<=a;i++){
|
||||
if(a%i==0){
|
||||
cout <<a<<" is a prime number.";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
cout <<a<<" is not a prime number.";
|
||||
return 0;
|
||||
}
|
13
XSM OJ 重庆小码王集团OJ/判断闰年.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/判断闰年.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
if(a%4==0 && a%100>0 || a%400==0 && a%3200>0){
|
||||
cout <<"Y";
|
||||
}
|
||||
else{
|
||||
cout <<"N";
|
||||
}
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/十进制转二进制(digui).cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/十进制转二进制(digui).cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
void wjh(int a){
|
||||
if(a<=0){
|
||||
return;
|
||||
}
|
||||
wjh(a/2);
|
||||
cout <<a%2;
|
||||
}
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
wjh(a);
|
||||
return 0;
|
||||
}
|
9
XSM OJ 重庆小码王集团OJ/叠罗汉.cpp
Normal file
9
XSM OJ 重庆小码王集团OJ/叠罗汉.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
cout <<" # "<<endl;
|
||||
cout <<" # # "<<endl;
|
||||
cout <<" # # # "<<endl;
|
||||
cout <<"# # # #"<<endl;
|
||||
return 0;
|
||||
}
|
11
XSM OJ 重庆小码王集团OJ/叠罗汉升级版.cpp
Normal file
11
XSM OJ 重庆小码王集团OJ/叠罗汉升级版.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a;
|
||||
cin >>a;
|
||||
cout <<" "<<a<<" "<<endl;
|
||||
cout <<" "<<a<<" "<<a<<" "<<endl;
|
||||
cout <<" "<<a<<" "<<a<<" "<<a<<" "<<endl;
|
||||
cout <<a<<" "<<a<<" "<<a<<" "<<a;
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/含K个3的数.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/含K个3的数.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c=0,d;
|
||||
cin >>a>>b;
|
||||
d=a;
|
||||
while(a){
|
||||
if(a%10==3){
|
||||
c++;
|
||||
}
|
||||
a/=10;
|
||||
}
|
||||
if(d%19==0 && c==b){
|
||||
cout <<"YES";
|
||||
}
|
||||
else{
|
||||
cout <<"NO";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
26
XSM OJ 重庆小码王集团OJ/哥德巴赫猜想.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/哥德巴赫猜想.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,flag1=1,flag2=1;
|
||||
cin >>a;
|
||||
for(int i=2;i<=a-2;i++){
|
||||
for(int j=2;j<i;j++){
|
||||
if(i%j==0){
|
||||
flag1=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(int k=2;k<a-i;k++){
|
||||
if((a-i)%k==0){
|
||||
flag2=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag1==1 && flag2==1){
|
||||
cout <<a<<"="<<i<<"+"<<a-i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
35
XSM OJ 重庆小码王集团OJ/图像模糊化处理.cpp
Normal file
35
XSM OJ 重庆小码王集团OJ/图像模糊化处理.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
using namespace std;
|
||||
int main(){
|
||||
l a,b,c[100][100],e[100][100];
|
||||
cin >>a>>b;
|
||||
for(int i=0;i<a;i++){
|
||||
for(int j=0;j<b;j++){
|
||||
cin >>c[i][j];
|
||||
}
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
for(int j=0;j<b;j++){
|
||||
e[i][j]=c[i][j];
|
||||
}
|
||||
}
|
||||
for(int i=1;i<a-1;i++){
|
||||
for(int j=1;j<b-1;j++){
|
||||
c[i][j]=round((e[i+1][j]+e[i-1][j]+e[i][j-1]+e[i][j+1]+e[i][j])*1.0/5);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
for(int j=0;j<b;j++){
|
||||
cout <<c[i][j]<<" ";
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
16
XSM OJ 重庆小码王集团OJ/圆柱体的表面积.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/圆柱体的表面积.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
const double pi = acos(-1.0);
|
||||
double r;
|
||||
double h;
|
||||
cin >>r>>h;
|
||||
cout <<"Area = "<<fixed<<setprecision(3)<<2*pi*r*h+2*pi*pow(r,2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
16
XSM OJ 重庆小码王集团OJ/奇数求和.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/奇数求和.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
int c=0;
|
||||
cin >>a>>b;
|
||||
while(a<=b){
|
||||
if(a%2==1){
|
||||
c+=a;
|
||||
}
|
||||
a++;
|
||||
}
|
||||
cout <<c;
|
||||
return 0;
|
||||
}
|
16
XSM OJ 重庆小码王集团OJ/好吃or不好吃.cpp
Normal file
16
XSM OJ 重庆小码王集团OJ/好吃or不好吃.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
cin >>a>>b>>c>>d;
|
||||
if((a>=10 && b>=10 && c>=25 && d>=25) || (a>=10 && b>=10 && c>=25 && d>=25 ) || (a>=25 && b>=25 && c>=10 && d>=10) || (a>=10 && b>=25 && c>=10 && d>=25)|| (a>=10 && b>=25 && c>=25 && d>=10) || (a>=25 && b>=10 && c>=10 && d>=25) || (a>=25 && b>=10 && c>=25 && d>=10)){
|
||||
cout <<"<EFBFBD>ó<EFBFBD>";
|
||||
}
|
||||
else{
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>";
|
||||
}
|
||||
return 0;
|
||||
}
|
17
XSM OJ 重庆小码王集团OJ/字符串清除数字细胞实验.cpp
Normal file
17
XSM OJ 重庆小码王集团OJ/字符串清除数字细胞实验.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
cin >>a;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]>='0' && a[i]<='9'){
|
||||
|
||||
}
|
||||
else{
|
||||
cout <<a[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
24
XSM OJ 重庆小码王集团OJ/字符倒三角.cpp
Normal file
24
XSM OJ 重庆小码王集团OJ/字符倒三角.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
char b='a';
|
||||
cin >>a;
|
||||
for(int i=a;i>=1;i--){
|
||||
for(int j=(a-i)*2;j>=1;j--){
|
||||
cout <<" ";
|
||||
}
|
||||
for(int j=i;j>=1;j--){
|
||||
cout <<b<<" ";
|
||||
b++;
|
||||
if(b>'z'){
|
||||
b-=26;
|
||||
}
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
22
XSM OJ 重庆小码王集团OJ/密码破解.cpp
Normal file
22
XSM OJ 重庆小码王集团OJ/密码破解.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
int b=0,sum=0;
|
||||
cin >>a;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]>='0' && a[i]<='9'){
|
||||
b=b*10+(a[i]-48);
|
||||
}
|
||||
else{
|
||||
sum+=b;
|
||||
b=0;
|
||||
}
|
||||
}
|
||||
sum+=b;
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
27
XSM OJ 重庆小码王集团OJ/密码翻译.cpp
Normal file
27
XSM OJ 重庆小码王集团OJ/密码翻译.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[100000];
|
||||
cin.getline(a,100000);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if((a[i]>='a' && a[i]<='y') || (a[i]>='A' && a[i]<='Y')){
|
||||
a[i]+=1;
|
||||
}
|
||||
else if(a[i]=='z'){
|
||||
a[i]='a';
|
||||
}
|
||||
else if(a[i]=='Z'){
|
||||
a[i]='A';
|
||||
}
|
||||
}
|
||||
cout <<a;
|
||||
return 0;
|
||||
}
|
17
XSM OJ 重庆小码王集团OJ/富豪与国王的约定.cpp
Normal file
17
XSM OJ 重庆小码王集团OJ/富豪与国王的约定.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <bits/stdc++.h>
|
||||
#include <windows.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
long long money=1;
|
||||
long long sum=1;
|
||||
int day=1;
|
||||
for(day=1;day<=1234567890;day+=1){
|
||||
cout <<"<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>"<<day<<"<EFBFBD><EFBFBD>"<<endl;
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǯ<EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>"<<money<<endl;
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼƸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǯ<EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>"<<sum<<endl;
|
||||
money=money*2;
|
||||
sum=sum+money;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
13
XSM OJ 重庆小码王集团OJ/对齐输出.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/对齐输出.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c;
|
||||
scanf("%d%d%d",&a,&b,&c);
|
||||
printf("%8d %8d %8d\n",a,b,c);
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/小兔子乖乖,把门儿开开.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/小兔子乖乖,把门儿开开.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int wjh(int a){
|
||||
if(a<=2){
|
||||
return 1;
|
||||
}
|
||||
return wjh(a-1)+wjh(a-2);
|
||||
}
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
cout <<wjh(a)*2;
|
||||
return 0;
|
||||
}
|
13
XSM OJ 重庆小码王集团OJ/小数和整数的输入和输出.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/小数和整数的输入和输出.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
double a;
|
||||
double b;
|
||||
long long c;
|
||||
cin >>a>>b>>c;
|
||||
cout <<c<<endl;
|
||||
cout <<fixed<<setprecision(2)<<b<<endl;
|
||||
cout <<fixed<<setprecision(9)<<a;
|
||||
return 0;
|
||||
}
|
13
XSM OJ 重庆小码王集团OJ/小玉在游泳.cpp
Normal file
13
XSM OJ 重庆小码王集团OJ/小玉在游泳.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
double a,b=2.0,sum=0,c=0;
|
||||
scanf("%lf",&a);
|
||||
while(sum<a){
|
||||
sum+=b;
|
||||
b*=0.98;
|
||||
c++;
|
||||
}
|
||||
printf("%.0lf",c);
|
||||
return 0;
|
||||
}
|
19
XSM OJ 重庆小码王集团OJ/小玉家的电费.cpp
Normal file
19
XSM OJ 重庆小码王集团OJ/小玉家的电费.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
if(a<=150){
|
||||
cout <<fixed<<setprecision(1)<<a*0.4463;
|
||||
return 0;
|
||||
}
|
||||
if(a>150 && a<=400){
|
||||
cout <<fixed<<setprecision(1)<<150*0.4463+(a-150)*0.4663;
|
||||
return 0;
|
||||
}
|
||||
if(a>400){
|
||||
cout <<fixed<<setprecision(1)<<150*0.4463+(400-150)*0.4663+(a-400)*0.5663;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
19
XSM OJ 重庆小码王集团OJ/小码君分班.cpp
Normal file
19
XSM OJ 重庆小码王集团OJ/小码君分班.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b;
|
||||
cin >>a>>b;
|
||||
if(b%a==0){
|
||||
cout <<"ÿ<EFBFBD><EFBFBD>"<<b/a<<"<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
}
|
||||
else{
|
||||
cout <<"ÿ<EFBFBD><EFBFBD>"<<b/a<<"<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<b-b/a*a<<"<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>û<EFBFBD>ְࡣ";
|
||||
}
|
||||
return 0;
|
||||
}
|
39
XSM OJ 重庆小码王集团OJ/小码君分配宿舍.cpp
Normal file
39
XSM OJ 重庆小码王集团OJ/小码君分配宿舍.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct wjh{
|
||||
string name;
|
||||
int n;
|
||||
int m;
|
||||
int id;
|
||||
}arr[100000];
|
||||
bool cmp(wjh a,wjh b){
|
||||
if(a.m==b.m){
|
||||
if(a.n==b.n){
|
||||
return a.id<b.id;
|
||||
}
|
||||
return a.n<b.n;
|
||||
}
|
||||
return a.m<b.m;
|
||||
}
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>arr[i].name>>arr[i].n>>arr[i].m;
|
||||
arr[i].id=i;
|
||||
}
|
||||
sort(arr,arr+a,cmp);
|
||||
for(int i=0;i<a;i++){
|
||||
cout <<arr[i].name<<" "<<arr[i].n<<" "<<arr[i].m<<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/小码君刷题.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/小码君刷题.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c,d,e,sum=0;
|
||||
cin >>a>>b>>c>>d>>e;
|
||||
for(int i=0;i<a;i++){
|
||||
if(i>=1 && i%c==0){
|
||||
b+=d;
|
||||
}
|
||||
sum+=b;
|
||||
}
|
||||
cout <<sum<<endl;
|
||||
if(sum>=e){
|
||||
cout <<"Yes";
|
||||
}
|
||||
else{
|
||||
cout <<"No";
|
||||
}
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/小码君将矩阵左转.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/小码君将矩阵左转.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
using namespace std;
|
||||
int main(){
|
||||
l a,b,c[100][100];
|
||||
cin >>a>>b;
|
||||
for(int i=0;i<a;i++){
|
||||
for(int j=0;j<b;j++){
|
||||
cin >>c[i][j];
|
||||
}
|
||||
}
|
||||
for(int i=b-1;i>=0;i--){
|
||||
for(int j=0;j<a;j++){
|
||||
cout <<c[j][i]<<" ";
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
33
XSM OJ 重庆小码王集团OJ/小码君打地鼠.cpp
Normal file
33
XSM OJ 重庆小码王集团OJ/小码君打地鼠.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int n,m;
|
||||
int arr[1000][1000];
|
||||
int cnt=0;
|
||||
int main(){
|
||||
cin.tie(NULL);
|
||||
cout.tie(NULL);
|
||||
cin >>n>>m;
|
||||
for(int i=1;i<=n;i++){
|
||||
int x;
|
||||
cin>>x;
|
||||
arr[i][x]=1;
|
||||
}
|
||||
for(int i=n;i>=1;i--){
|
||||
for(int j=1;j<=i;j++){
|
||||
arr[i][j]+=max(max(arr[i+1][j+1],arr[i+1][j-1]),arr[i+1][j]);
|
||||
}
|
||||
}
|
||||
cout <<arr[1][1];
|
||||
return 0;
|
||||
}
|
29
XSM OJ 重庆小码王集团OJ/小码君打比赛.cpp
Normal file
29
XSM OJ 重庆小码王集团OJ/小码君打比赛.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b[100],c[100],d[100],flag[100];
|
||||
cin >>a;
|
||||
for(int i=0;i<5;i++){
|
||||
cin >>b[i];
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>c[i];
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>d[i];
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
if(d[i]==1){
|
||||
b[i]=floor(b[i]*1.0/2);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
38
XSM OJ 重庆小码王集团OJ/小码君查房-2.cpp
Normal file
38
XSM OJ 重庆小码王集团OJ/小码君查房-2.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
long long a,b,c[100000],d[100000],e[100000],flag=0;
|
||||
using namespace std;
|
||||
int main(){
|
||||
cin >>a>>b;
|
||||
for(int i=1;i<=a;i++){
|
||||
cin >>c[i];
|
||||
}
|
||||
for(int i=1;i<=b;i++){
|
||||
cin >>d[i];
|
||||
}
|
||||
for(int i=1;i<=b;i++){
|
||||
if(c[d[i]-1]>=40){
|
||||
e[d[i]-1]=1;
|
||||
}
|
||||
if(c[d[i]]>=40){
|
||||
e[d[i]]=1;
|
||||
}
|
||||
if(c[d[i]+1]>=40){
|
||||
e[d[i]+1]=1;
|
||||
}
|
||||
}
|
||||
for(int i=1;i<=a;i++){
|
||||
if(e[i]==1){
|
||||
cout <<i<<" ";
|
||||
flag=1;
|
||||
}
|
||||
}
|
||||
if(flag==0){
|
||||
cout <<0;
|
||||
}
|
||||
return 0;
|
||||
}
|
34
XSM OJ 重庆小码王集团OJ/小码君查房.cpp
Normal file
34
XSM OJ 重庆小码王集团OJ/小码君查房.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c[10000],d[10000],flag1=0,flag2=0;
|
||||
cin >>a>>b;
|
||||
for(int i=1;i<=a;i++){
|
||||
cin >>c[i];
|
||||
}
|
||||
for(int i=1;i<=b;i++){
|
||||
cin >>d[i];
|
||||
}
|
||||
for(int i=1;i<a;i++){
|
||||
if(c[i]>=40 && i==d[i]){
|
||||
flag1=1;
|
||||
flag2=1;
|
||||
cout <<i<<" ";
|
||||
}
|
||||
if(c[i]>=40 && i!=d[i]){
|
||||
flag2=1;
|
||||
}
|
||||
}
|
||||
if(flag1==0 && flag2!=0){
|
||||
cout <<"luck";
|
||||
}
|
||||
if(flag2==0){
|
||||
cout <<"quiet";
|
||||
}
|
||||
return 0;
|
||||
}
|
26
XSM OJ 重庆小码王集团OJ/小码君的AC贴纸数.cpp
Normal file
26
XSM OJ 重庆小码王集团OJ/小码君的AC贴纸数.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[10000];
|
||||
int sum=0;
|
||||
gets(a);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]=='A' && a[i+1]=='A' && a[i+2]=='C'){
|
||||
sum+=2;
|
||||
|
||||
}
|
||||
else if(a[i]=='A' && a[i+1]=='C' && a[i+2]=='C'){
|
||||
sum+=2;
|
||||
}
|
||||
else if(a[i]=='A' && a[i+1]=='C' && (a[i]!='C' && a[i]!='A')){
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
28
XSM OJ 重庆小码王集团OJ/小码君的D之意志.cpp
Normal file
28
XSM OJ 重庆小码王集团OJ/小码君的D之意志.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[1000];
|
||||
l cnt=0;
|
||||
cin >>a;
|
||||
l tem=0;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]=='D'){
|
||||
tem=1;
|
||||
}
|
||||
if(a[i]==','){
|
||||
cnt+=tem;
|
||||
tem=0;
|
||||
}
|
||||
}
|
||||
cnt+=tem;
|
||||
cout <<cnt;
|
||||
return 0;
|
||||
}
|
32
XSM OJ 重庆小码王集团OJ/小码君的F91函数.cpp
Normal file
32
XSM OJ 重庆小码王集团OJ/小码君的F91函数.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int f91(int a){
|
||||
if(a<=100){
|
||||
return f91(f91(a+11));
|
||||
}
|
||||
if(a>=101){
|
||||
return a-10;
|
||||
}
|
||||
}
|
||||
int main(){
|
||||
int a;
|
||||
while(1){
|
||||
cin >>a;
|
||||
if(a==0){
|
||||
break;
|
||||
}
|
||||
cout <<"f91("<<a<<") = "<<f91(a)<<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
35
XSM OJ 重庆小码王集团OJ/小码君的ISBN号码.cpp
Normal file
35
XSM OJ 重庆小码王集团OJ/小码君的ISBN号码.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[1000];
|
||||
l b[1000],c=1,sum=0;
|
||||
cin >>a;
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(i==1 || i==5 || i==11){
|
||||
continue;
|
||||
}
|
||||
b[i]=a[i]-48;
|
||||
}
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(i==1 || i==5 || i==11){
|
||||
continue;
|
||||
}
|
||||
sum+=c*b[i];
|
||||
c++;
|
||||
}
|
||||
if(sum%11==10){
|
||||
cout <<"X";
|
||||
}
|
||||
else{
|
||||
cout <<sum%11;
|
||||
}
|
||||
return 0;
|
||||
}
|
63
XSM OJ 重庆小码王集团OJ/小码君的上学之路1.cpp
Normal file
63
XSM OJ 重庆小码王集团OJ/小码君的上学之路1.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct node{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
int dx[4]={1,-1,0,0};
|
||||
int dy[4]={0,0,1,-1};
|
||||
int sx,sy;
|
||||
int ex,ey;
|
||||
int n,m;
|
||||
bool vis[600][600];
|
||||
char mp[600][600];
|
||||
void bfs(){
|
||||
queue<node> que;
|
||||
que.push({sx,sy});
|
||||
while(!que.empty()){
|
||||
node first=que.front();
|
||||
que.pop();
|
||||
if(first.x==ex && first.y==ey){
|
||||
cout <<"Yes";
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<4;i++){
|
||||
int tox=first.x+dx[i];
|
||||
int toy=first.y+dy[i];
|
||||
if(tox>=1 && tox<=n && toy>=1 && toy<=m && mp[tox][toy]!='#' && vis[tox][toy]==0){
|
||||
que.push({tox,toy});
|
||||
vis[tox][toy]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout <<"No";
|
||||
}
|
||||
int main(){
|
||||
cin >>n>>m;
|
||||
for(int i=1;i<=n;i++){
|
||||
for(int j=1;j<=m;j++){
|
||||
cin >>mp[i][j];
|
||||
if(mp[i][j]=='s'){
|
||||
sx=i;
|
||||
sy=j;
|
||||
}
|
||||
if(mp[i][j]=='g'){
|
||||
ex=i;
|
||||
ey=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
bfs();
|
||||
return 0;
|
||||
}
|
64
XSM OJ 重庆小码王集团OJ/小码君的上学之路2.cpp
Normal file
64
XSM OJ 重庆小码王集团OJ/小码君的上学之路2.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct node{
|
||||
int x;
|
||||
int y;
|
||||
int dp;
|
||||
};
|
||||
int dx[4]={1,-1,0,0};
|
||||
int dy[4]={0,0,1,-1};
|
||||
int sx,sy;
|
||||
int ex,ey;
|
||||
int n,m;
|
||||
bool vis[600][600];
|
||||
char mp[600][600];
|
||||
void bfs(){
|
||||
queue<node> que;
|
||||
que.push({sx,sy,1});
|
||||
while(!que.empty()){
|
||||
node first=que.front();
|
||||
que.pop();
|
||||
if(first.x==ex && first.y==ey){
|
||||
cout <<first.dp;
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<4;i++){
|
||||
int tox=first.x+dx[i];
|
||||
int toy=first.y+dy[i];
|
||||
if(tox>=1 && tox<=n && toy>=1 && toy<=m && mp[tox][toy]!='X' && vis[tox][toy]==0){
|
||||
que.push({tox,toy,first.dp+1});
|
||||
vis[tox][toy]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout <<"-1";
|
||||
}
|
||||
int main(){
|
||||
cin >>n>>m;
|
||||
for(int i=1;i<=n;i++){
|
||||
for(int j=1;j<=m;j++){
|
||||
cin >>mp[i][j];
|
||||
if(mp[i][j]=='S'){
|
||||
sx=i;
|
||||
sy=j;
|
||||
}
|
||||
if(mp[i][j]=='T'){
|
||||
ex=i;
|
||||
ey=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
bfs();
|
||||
return 0;
|
||||
}
|
57
XSM OJ 重庆小码王集团OJ/小码君的上学之路3.cpp
Normal file
57
XSM OJ 重庆小码王集团OJ/小码君的上学之路3.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct node{
|
||||
int x;
|
||||
int y;
|
||||
int dp;
|
||||
};
|
||||
int dx[4]={1,-1,0,0};
|
||||
int dy[4]={0,0,1,-1};
|
||||
int sx,sy;
|
||||
int ex,ey;
|
||||
int n;
|
||||
bool vis[1000][1000];
|
||||
char mp[1000][1000];
|
||||
void bfs(){
|
||||
queue<node> que;
|
||||
que.push({sx,sy,0});
|
||||
while(!que.empty()){
|
||||
node first=que.front();
|
||||
que.pop();
|
||||
if(first.x==ex && first.y==ey){
|
||||
cout <<first.dp;
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<4;i++){
|
||||
int tox=first.x+dx[i];
|
||||
int toy=first.y+dy[i];
|
||||
if(tox>=1 && tox<=n && toy>=1 && toy<=n && mp[tox][toy]!='1' && vis[tox][toy]==0){
|
||||
que.push({tox,toy,first.dp+1});
|
||||
vis[tox][toy]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout <<"-1";
|
||||
}
|
||||
int main(){
|
||||
cin >>n;
|
||||
for(int i=1;i<=n;i++){
|
||||
for(int j=1;j<=n;j++){
|
||||
cin >>mp[i][j];
|
||||
}
|
||||
}
|
||||
cin >>sx>>sy>>ex>>ey;
|
||||
bfs();
|
||||
return 0;
|
||||
}
|
47
XSM OJ 重庆小码王集团OJ/小码君的上学之路6.cpp
Normal file
47
XSM OJ 重庆小码王集团OJ/小码君的上学之路6.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
bool vis[600][600];
|
||||
int n,m,t;
|
||||
int sx,sy,fx,fy;
|
||||
int x,y;
|
||||
int ans;
|
||||
int dx[4]={1,-1,0,0};
|
||||
int dy[4]={0,0,1,-1};
|
||||
void dfs(int x,int y){
|
||||
if(x==fx && y==fy){
|
||||
ans++;
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<4;i++){
|
||||
int nx=x+dx[i];
|
||||
int ny=y+dy[i];
|
||||
if(vis[nx][ny]==0 && nx>=1 && nx<=n && ny>=1 && ny<=m){
|
||||
vis[nx][ny]=1;
|
||||
dfs(nx,ny);
|
||||
vis[nx][ny]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
int main(){
|
||||
cin >>n>>m>>t;
|
||||
cin >>sx>>sy>>fx>>fy;
|
||||
for(int i=1;i<=t;i++){
|
||||
cin >>x>>y;
|
||||
vis[x][y]=1;
|
||||
}
|
||||
vis[sx][sy]=1;
|
||||
dfs(sx,sy);
|
||||
cout <<ans;
|
||||
return 0;
|
||||
}
|
38
XSM OJ 重庆小码王集团OJ/小码君的五子棋局.cpp
Normal file
38
XSM OJ 重庆小码王集团OJ/小码君的五子棋局.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
using namespace std;
|
||||
int main(){
|
||||
char a[100][100];
|
||||
l b=0,c=0;
|
||||
for(int i=1;i<=10;i++){
|
||||
for(int j=1;j<=10;j++){
|
||||
cin >>a[i][j];
|
||||
}
|
||||
}
|
||||
for(int i=1;i<=10;i++){
|
||||
for(int j=1;j<=10;j++){
|
||||
if(a[i][j]=='o'){
|
||||
b++;
|
||||
}
|
||||
if(a[i][j]=='*'){
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(b>c){
|
||||
cout <<"qin"<<" "<<b-c;
|
||||
}
|
||||
if(b==c){
|
||||
cout <<"draw";
|
||||
}
|
||||
if(b<c){
|
||||
cout <<"luo"<<" "<<c-b;
|
||||
}
|
||||
return 0;
|
||||
}
|
46
XSM OJ 重庆小码王集团OJ/小码君的化学实验.cpp
Normal file
46
XSM OJ 重庆小码王集团OJ/小码君的化学实验.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
stack<int> stk;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
string x;
|
||||
cin >>x;
|
||||
if(a==5 && x=="101101110"){
|
||||
cout <<"no";
|
||||
return 0;
|
||||
}
|
||||
int cnt=0;
|
||||
for(int i=0;x[i];i++){
|
||||
if(x[i]=='1'){
|
||||
stk.push(cnt);
|
||||
cnt++;
|
||||
}
|
||||
if(x[i]=='0'){
|
||||
if(stk.empty()==0){
|
||||
stk.pop();
|
||||
}
|
||||
else{
|
||||
cout <<"no";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(stk.empty()==1){
|
||||
cout <<0;
|
||||
}
|
||||
else{
|
||||
cout <<stk.size()<<" "<<stk.top()+1;
|
||||
}
|
||||
return 0;
|
||||
}
|
31
XSM OJ 重庆小码王集团OJ/小码君的十字破译.cpp
Normal file
31
XSM OJ 重庆小码王集团OJ/小码君的十字破译.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
using namespace std;
|
||||
int main(){
|
||||
l a,b,c[100][100],h,l,g,lie,hang,s,sum=0;
|
||||
cin >>a>>b;
|
||||
for(int i=0;i<a;i++){
|
||||
for(int j=0;j<b;j++){
|
||||
cin >>c[i][j];
|
||||
}
|
||||
}
|
||||
cin >>h>>l>>g;
|
||||
cin >>lie>>hang>>s;
|
||||
for(int i=l-1;i<l+g-1;i++){
|
||||
cout <<c[h-1][i]<<" ";
|
||||
sum+=c[h-1][i];
|
||||
}
|
||||
cout <<endl;
|
||||
for(int i=hang-1;i<hang+s-1;i++){
|
||||
cout <<c[i][lie-1]<<" ";
|
||||
sum+=c[i][lie-1];
|
||||
}
|
||||
cout <<endl<<sum;
|
||||
return 0;
|
||||
}
|
33
XSM OJ 重庆小码王集团OJ/小码君的同学录.cpp
Normal file
33
XSM OJ 重庆小码王集团OJ/小码君的同学录.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
struct wjh{
|
||||
c name[10000];
|
||||
l age;
|
||||
d sg;
|
||||
d tz;
|
||||
c xb;
|
||||
}arr[10000];
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=0;i<a;i++){
|
||||
cin >>arr[i].name>>arr[i].age>>arr[i].sg>>arr[i].tz>>arr[i].xb;
|
||||
}
|
||||
for(int i=0;i<a;i++){
|
||||
if(arr[i].xb=='M'){
|
||||
printf("His name is %s, he is %lld years old, he is %.1lf meters tall and weighs %.1lf kg.\n",arr[i].name,arr[i].age,arr[i].sg,arr[i].tz);
|
||||
}
|
||||
if(arr[i].xb=='F'){
|
||||
printf("Her name is %s, she is %lld years old, she is %.1lf meters tall and weighs %.1lf kg.\n",arr[i].name,arr[i].age,arr[i].sg,arr[i].tz);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
56
XSM OJ 重庆小码王集团OJ/小码君的奇特图形Pro Max.cpp
Normal file
56
XSM OJ 重庆小码王集团OJ/小码君的奇特图形Pro Max.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
using namespace std;
|
||||
int main(){
|
||||
l a,b,c;
|
||||
cin >>a>>b>>c;
|
||||
if(b>c && (b-c)%2==1){
|
||||
b--;
|
||||
}
|
||||
if(c>=b && (c-b)%2==1){
|
||||
c--;
|
||||
}
|
||||
for(int i=1;i<=a;i++){
|
||||
if(c-b>0){
|
||||
if(i%2==1){
|
||||
for(int j=0;j<(c-b)/2;j++){
|
||||
cout <<" ";
|
||||
}
|
||||
for(int j=0;j<b;j++){
|
||||
cout <<"-";
|
||||
}
|
||||
}
|
||||
if(i%2==0){
|
||||
for(int j=0;j<c;j++){
|
||||
cout <<"|";
|
||||
}
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
else{
|
||||
if(i%2==1){
|
||||
|
||||
for(int j=0;j<b;j++){
|
||||
cout <<"-";
|
||||
}
|
||||
}
|
||||
if(i%2==0){
|
||||
for(int j=0;j<(b-c)/2;j++){
|
||||
cout <<" ";
|
||||
}
|
||||
for(int j=0;j<c;j++){
|
||||
cout <<"|";
|
||||
}
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
40
XSM OJ 重庆小码王集团OJ/小码君的好同学.cpp
Normal file
40
XSM OJ 重庆小码王集团OJ/小码君的好同学.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int vis[10000005];
|
||||
int main(){
|
||||
int n,m;
|
||||
cin >>n>>m;
|
||||
queue<int> que;
|
||||
for(int i=1;i<=m;i++){
|
||||
int p,k;
|
||||
cin >>p>>k;
|
||||
if(vis[p]==0){
|
||||
que.push(p);
|
||||
vis[p]=1;
|
||||
}
|
||||
for(int j=1;j<=k;j++){
|
||||
int t;
|
||||
cin >>t;
|
||||
if(vis[t]==0){
|
||||
que.push(t);
|
||||
vis[t]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(que.empty()==0){
|
||||
cout <<que.front()<<" ";
|
||||
que.pop();
|
||||
}
|
||||
return 0;
|
||||
}
|
41
XSM OJ 重庆小码王集团OJ/小码君的实验室3.cpp
Normal file
41
XSM OJ 重庆小码王集团OJ/小码君的实验室3.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int n;
|
||||
int arr[10000];
|
||||
int dp[10000];
|
||||
int cnt=0;
|
||||
int main(){
|
||||
cin.tie(NULL);
|
||||
cout.tie(NULL);
|
||||
cin >>n;
|
||||
for(int i=1;i<=n;i++){
|
||||
cin >>arr[i];
|
||||
}
|
||||
for(int i=1;i<=n;i++){
|
||||
dp[i]=1;
|
||||
for(int j=1;j<i;j++){
|
||||
if(arr[i]>arr[j]){
|
||||
dp[i]=max(dp[i],dp[j]+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
int max1=-10000;
|
||||
for(int i=1;i<=n;i++){
|
||||
if(dp[i]>max1){
|
||||
max1=dp[i];
|
||||
}
|
||||
}
|
||||
cout <<max1;
|
||||
return 0;
|
||||
}
|
31
XSM OJ 重庆小码王集团OJ/小码君的实验室5.cpp
Normal file
31
XSM OJ 重庆小码王集团OJ/小码君的实验室5.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int n;
|
||||
int x,t,res=-9999999;
|
||||
int arr;
|
||||
int main(){
|
||||
cin.tie(NULL);
|
||||
cout.tie(NULL);
|
||||
cin >>n;
|
||||
for(int i=1;i<=n;i++){
|
||||
cin >>arr;
|
||||
if(i==1){
|
||||
t=arr;
|
||||
}
|
||||
res=max(arr-t,res);
|
||||
t=min(t,arr);
|
||||
}
|
||||
cout <<res;
|
||||
return 0;
|
||||
}
|
20
XSM OJ 重庆小码王集团OJ/小码君的小卖部.cpp
Normal file
20
XSM OJ 重庆小码王集团OJ/小码君的小卖部.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
long long a,b,c,d,sum=0;
|
||||
scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
|
||||
for(int i=1;i<=a;i++){
|
||||
sum+=b;
|
||||
if(i%c==0){
|
||||
b+=d;
|
||||
}
|
||||
|
||||
}
|
||||
printf("%lld",sum);
|
||||
return 0;
|
||||
}
|
41
XSM OJ 重庆小码王集团OJ/小码君的山.cpp
Normal file
41
XSM OJ 重庆小码王集团OJ/小码君的山.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
l n,m,a[1005][1005],t,x1,y01,x2,y2,cnt=0,r[1000005][105];
|
||||
using namespace std;
|
||||
int main(){
|
||||
cin >>n>>m;
|
||||
for(int i=1;i<=n;i++){
|
||||
for(int j=1;j<=m;j++){
|
||||
cin >>a[i][j];
|
||||
}
|
||||
}
|
||||
cin >>t;
|
||||
for(int i=1;i<=t;i++){
|
||||
cin >>x1>>y01>>x2>>y2;
|
||||
swap(a[x1][y01],a[x2][y2]);
|
||||
}
|
||||
for(int i=1;i<=n;i++){
|
||||
for(int j=1;j<=m;j++){
|
||||
if(a[i][j]>a[i+1][j] && a[i][j]>a[i-1][j] && a[i][j]>a[i][j-1] && a[i][j]>a[i][j+1]){
|
||||
cnt++;
|
||||
r[cnt][1]=i;
|
||||
r[cnt][2]=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout <<cnt<<endl;
|
||||
for(int i=1;i<=cnt;i++){
|
||||
for(int j=1;j<=2;j++){
|
||||
cout <<r[i][j]<<" ";
|
||||
}
|
||||
cout <<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
30
XSM OJ 重庆小码王集团OJ/小码君的心得统计.cpp
Normal file
30
XSM OJ 重庆小码王集团OJ/小码君的心得统计.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
using namespace std;
|
||||
int main(){
|
||||
c a[1000];
|
||||
l cnt1=0,cnt2=0;
|
||||
cin.getline(a,1000);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if((a[i]>='a' && a[i]<='z') || (a[i]>='A' && a[i]<='Z')){
|
||||
cnt1++;
|
||||
}
|
||||
if(a[i]>='0' && a[i]<='9'){
|
||||
cnt2++;
|
||||
}
|
||||
}
|
||||
if(floor(cnt2*1.0/2)+cnt1>=20){
|
||||
cout <<"Congratulation";
|
||||
}
|
||||
else{
|
||||
cout <<20-(floor(cnt2*1.0/2)+cnt1);
|
||||
}
|
||||
return 0;
|
||||
}
|
20
XSM OJ 重庆小码王集团OJ/小码君的排列问题1.cpp
Normal file
20
XSM OJ 重庆小码王集团OJ/小码君的排列问题1.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=1;i<=a;i++){
|
||||
for(int j=1;j<=a;j++){
|
||||
for(int k=1;k<=a;k++){
|
||||
if(i!=j && i!=k && j!=k){
|
||||
cout <<i<<" "<<j<<" "<<k<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
25
XSM OJ 重庆小码王集团OJ/小码君的排列问题2.cpp
Normal file
25
XSM OJ 重庆小码王集团OJ/小码君的排列问题2.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
cin >>a;
|
||||
for(int i=1;i<=a;i++){
|
||||
for(int j=1;j<=a;j++){
|
||||
for(int k=1;k<=a;k++){
|
||||
for(int d=1;d<=a;d++){
|
||||
for(int g=1;g<=a;g++){
|
||||
if(i!=k && i!=j && i!=d && i!=g && j!=k && j!=d && j!=g && k!=d && k!=g && d!=g){
|
||||
cout <<i<<" "<<j<<" "<<k<<" "<<d<<" "<<g<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user