Auto commit

This commit is contained in:
smallkun 2025-02-21 20:11:37 +08:00
parent c7ec5eb71f
commit e1993df158
10 changed files with 36 additions and 36 deletions

View File

@ -1,27 +1,27 @@
#include <stdio.h> #include <stdio.h>
/* /*
if(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>){ if(){
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ʱִ<EFBFBD><EFBFBD>) ()
}else{ }else{
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ʱִ<EFBFBD><EFBFBD>) ()
} }
*/ */
int main(void){ int main(void){
int x, y, z, t;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><EFBFBD> int x, y, z, t;//定义三个整型变量
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2; //数据类型 变量名1, 变量名2;
scanf("%d%d%d", &x, &y, &z); scanf("%d%d%d", &x, &y, &z);
if(x > y){ if(x > y){
t = x; t = x;
x = y; x = y;
y = t; y = t;
}//ʵ<EFBFBD><EFBFBD>x<EFBFBD><EFBFBD>y<EFBFBD>Ƚ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><79><CEBB> }//实现x和y比较 大数放y位置
if(y > z){ if(y > z){
t = y; t = y;
y = z; y = z;
z = t; z = t;
}//ʵ<EFBFBD><EFBFBD>y<EFBFBD><EFBFBD>z<EFBFBD>Ƚ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><7A><CEBB><7A><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }//实现y和z比较 大数放z位置 z为三个数字中最大数
if(x > y){ if(x > y){
t = x; t = x;
x = y; x = y;

View File

@ -6,7 +6,7 @@ int main(void){
int a; int a;
scanf("%d", &a); scanf("%d", &a);
printf("该数的位数为%d\n", printf("该数的位数为%d\n",
(a/10==0?1:(a/100==0?2:(a/1000==0?3:(a/10000==0?4:5))))); (a/10==0?1:(a/100==0?2:(a/1000==0?3:(a/10000==0?4:5)))));
printf("%d", a%10); printf("%d", a%10);
if(a%100/10 != 0){ if(a%100/10 != 0){

View File

@ -4,16 +4,16 @@ int main(void){
float a, b, result; float a, b, result;
int flag; int flag;
printf("请输入两个数字:"); printf("请输入两个数字:");
scanf("%f %f", &a, &b); scanf("%f %f", &a, &b);
printf("请输入您要进行的操作(1.做加法 2.做乘法 3.做除法):"); printf("请输入您要进行的操作(1.做加法 2.做乘法 3.做除法):");
scanf("%d", &flag); scanf("%d", &flag);
switch(flag){ switch(flag){
case 1:result = a+b;break; case 1:result = a+b;break;
case 2:result = a*b;break; case 2:result = a*b;break;
case 3:result = a/b;break; case 3:result = a/b;break;
} }
printf("结果为%f\n", result); printf("结果为%f\n", result);
return 0; return 0;
} }

View File

@ -7,7 +7,7 @@ int main(void){
scanf("%d-%d-%d", &year, &month, &day); scanf("%d-%d-%d", &year, &month, &day);
days+=day; days+=day;
//1 3 5 7 8 10 12 //1 3 5 7 8 10 12
//从前一个月开始依次 //从前一个月开始依次
switch(month-1){ switch(month-1){
case 11:days+=30; case 11:days+=30;
case 10:days+=31; case 10:days+=31;

View File

@ -2,17 +2,17 @@
/* /*
1. 1.
while((ch=getchar())!='\n') while((ch=getchar())!='\n')
2. 2.
ASCALL码范围 ASCALL码范围
*/ */
int main(){ int main(){
char ch; char ch;
int l, d, o;//l字母的个数 d为数字个数 o为其他字符个数 int l, d, o;//l字母的个数 d为数字个数 o为其他字符个数
l=d=o=0; l=d=o=0;
while((ch=getchar()) != '\n'){ while((ch=getchar()) != '\n'){
if(ch >= 'a' && ch<='z' || ch >= 'A' && ch<='Z' ){ if(ch >= 'a' && ch<='z' || ch >= 'A' && ch<='Z' ){
@ -23,7 +23,7 @@ int main(){
o++; o++;
} }
} }
printf("字母个数:%d 数字个数:%d 其他个数%d\n", l, d, o); printf("字母个数:%d 数字个数:%d 其他个数%d\n", l, d, o);
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
+ +
for(i=0;i<1000;i++){ for(i=0;i<1000;i++){
} }
@ -9,9 +9,9 @@ while(i<1000){
i++; i++;
} }
&& || ! && || !
1&&2 1&&2
1 2 1 2
*/ */
#include <stdio.h> #include <stdio.h>
@ -20,7 +20,7 @@ int main(){
int i; int i;
for(i=0;i<1000;i++){ for(i=0;i<1000;i++){
if(i%2==1 && i%3==2 && i%5==4 && i%6==5 && i%7==0){ if(i%2==1 && i%3==2 && i%5==4 && i%6==5 && i%7==0){
printf("台阶数为%d\n", i); printf("台阶数为%d\n", i);
break; break;
} }
} }

View File

@ -1,8 +1,8 @@
#include <stdio.h> #include <stdio.h>
/* /*
:i :i
:j :j
:k :k
*/ */
int main(){ int main(){
@ -11,7 +11,7 @@ int main(){
for(j=0;j<=50;j++){ for(j=0;j<=50;j++){
for(k=0;k<=200;k+=2){ for(k=0;k<=200;k+=2){
if(i+j+k==100 && i*3 + j*2 + k/2 == 100){ if(i+j+k==100 && i*3 + j*2 + k/2 == 100){
printf("大马:%-2d 中马:%-2d 小马:%-2d\n", i, j, k); printf("大马:%-2d 中马:%-2d 小马:%-2d\n", i, j, k);
} }
} }
} }

View File

@ -2,12 +2,12 @@
int main(){ int main(){
int i, s, t;//i用来遍历所有数, s用来存储数的位数,t是截取掉最高位之后的数 int i, s, t;//i用来遍历所有数, s用来存储数的位数,t是截取掉最高位之后的数
for(i=1;i<9999;i++){ for(i=1;i<9999;i++){
t = i; t = i;
while(t > 0){ while(t > 0){
s = (t/10==0?1:(t/100==0?2:(t/1000==0?3:4)));//求出这个数字位数 s = (t/10==0?1:(t/100==0?2:(t/1000==0?3:4)));//求出这个数字位数
t = i%(int)pow(10, s-1);//使用模除去掉最高位 t = i%(int)pow(10, s-1);//使用模除去掉最高位
if(t*t == i){ if(t*t == i){
printf("%d:%d\n", t, i); printf("%d:%d\n", t, i);
} }

View File

@ -2,17 +2,17 @@
int main(){ int main(){
/* /*
int x, n, t=1;//t为2当前需要加入的位置 int x, n, t=1;//t为2当前需要加入的位置
scanf("%d", &x); scanf("%d", &x);
n = x;//处理之后数 n = x;//处理之后数
while(t < x){//判断位置是否超过的数的范围 while(t < x){//判断位置是否超过的数的范围
n+=t*2; n+=t*2;
//根据当前输入位置判断前一位是否溢出如果溢出则减一 //根据当前输入位置判断前一位是否溢出如果溢出则减一
if(n/(t*10) != x/(t*10)){ if(n/(t*10) != x/(t*10)){
n-=(t*10); n-=(t*10);
} }
t*=10;//继续处理下一位 t*=10;//继续处理下一位
} }
printf("%d:%d\n", x, n); printf("%d:%d\n", x, n);
*/ */

View File

@ -9,7 +9,7 @@ int main(){
if(i%3==0){ if(i%3==0){
total *= 2; total *= 2;
} }
printf("%d月:%d个数\n", i, total); printf("%d月:%d个数\n", i, total);
} }
return 0; return 0;