跳到正文

个人记录

《那些年我犯得奇葩错误》

paramecium_约 4 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 4 分钟

版本

  1. v1当前

被吃掉的头文件

C++
using namespace std;
int main(){
	int a, b,c,d;
    int time1,time2,time3;
    cin>>a>>b>>c>>d;
    time1=a*60+b;
    time2=c*60+d;
    time3=time2-time1;
    cout<<time3/60<<" "<<time3%60<<endl;
	return 0;
}

神秘消失的变量

C++
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
	int y,z,a,b;
	cin>>y>>z;
    a=87*x+85*y;
    b=x+y
	cout<<fixed<<setprecision(3)<<1.0*a/b<<endl;
	return 0;
}

被吃掉的头文件和using…

C++
int main(){
	double a;
	cin>>a;
	if(a<0){
		cout<<ceil(a)<<endl;
	}
	else{
		cout<<floor(a)<<endl;
	}
	return 0;
}

集体潜逃的x和y

C++
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a>=b && a>=c){
		cout<<x<<endl;
	}
	else if(b>=a && b>=c){
		cout <<y<<endl;
	}
	else{
		cout<<z<<endl;
	}
	return 0;
}

判断变赋值

C++
#include<iostream>
using namespace std;
int main(){
	int m,t,s;
	cin>>m>>t>>s;
	int a=m-(1.0*s/t);
if(a%1=0){
	cout<<a-1<<endl;
}
else{
cout<<a<<endl;
}
	return 0;
}

;变成消失的它

C++
#include<iostream>
using namespace std;
int main(){
   int m,t,s;
   cin>>m>>t>>s;
   int a=1.0*s/t;
   if(m-a<0){
   cout<<0<<endl;
   }else{
   cout<<m-a<<endl}
	return 0;
}

原地无语的判断

C++
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
	double N;
	cin>>N;
	if(10<x<=20){
		cout<<fixed<<setprecision(3)<<N/2-1.5<<endl;
	}
	else if (5<N<=10){
		cout<<fixed<<setprecision(3)<<2-1.5*(N-3)*(N-3)<<endl;
	}
	else if(0<=N<=5){
		cout<<fixed<<setprecision(3)<<-N+2.5<<endl;
	}
	return 0;
}

奇葩赋值

C++
#include<iostream>
using namespace std;
int main(){
	int m,n,cnt==0;
	cin>>m>>n;
	for(int i=m;i<=n;i++){
		if(i%3==0&&i%5==0&&i%7==0){
			cout<<i<<" ";
			cnt++
		}
	}
	if(cnt==0){
		cout<<"0";
	}
	return 0;
}
原文