2024-11-30 09:44:38 +08:00
|
|
|
#include<iostream>
|
|
|
|
#include<windows.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <ctime>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
/*
|
|
|
|
int main(){
|
|
|
|
int a,b,c;
|
|
|
|
|
|
|
|
cin >>a>>b>>c;
|
|
|
|
|
2024-11-30 10:00:26 +08:00
|
|
|
if (a = 1)
|
2024-11-30 09:44:38 +08:00
|
|
|
{
|
|
|
|
cout <<"no";
|
|
|
|
Sleep(1000);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((a+b) > c)
|
|
|
|
{
|
|
|
|
cout <<"yes";
|
|
|
|
Sleep(1000);
|
|
|
|
return 0;
|
|
|
|
}else if ((a+c) > b)
|
|
|
|
{
|
|
|
|
cout <<"yes";
|
|
|
|
Sleep(1000);
|
|
|
|
return 0;
|
|
|
|
}else if ((b+c) > a)
|
|
|
|
{
|
|
|
|
cout <<"yes";
|
|
|
|
Sleep(1000);
|
|
|
|
return 0;
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
cout <<"no";
|
|
|
|
Sleep(1000);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(){ //三角形判断
|
|
|
|
int a,b,c;
|
|
|
|
|
|
|
|
cin >>a>>b>>c;
|
|
|
|
|
|
|
|
if ((a+b > c) && (a+c > b) && (b+c > a))
|
|
|
|
{
|
|
|
|
cout <<"yes";
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
cout <<"no";
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
srand(static_cast<unsigned int>(time(nullptr))); // 初始化随机数种子
|
|
|
|
int random_number = rand() % 5 + 1; // 生成 1 到 5 之间的随机数
|
|
|
|
cout <<random_number<<endl;
|
|
|
|
int player_cin;
|
|
|
|
|
|
|
|
cout <<"输入你猜的数字,1-5之间"<<endl;
|
|
|
|
cin >> player_cin;
|
|
|
|
|
|
|
|
if (player_cin == random_number)
|
|
|
|
{
|
|
|
|
cout <<"恭喜您,中奖了!奖金10元!"<<endl;
|
|
|
|
return 0;
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
cout <<"没中奖!请付费2元"<<endl;
|
|
|
|
cout <<"中奖号码是:"<<random_number<<endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2024-11-30 10:00:26 +08:00
|
|
|
}
|
2024-11-30 09:44:38 +08:00
|
|
|
|
|
|
|
int main(){
|
|
|
|
int n = 6;
|
|
|
|
|
|
|
|
//cin >> n;
|
|
|
|
|
|
|
|
int sum = n * (n+1) /2;
|
|
|
|
|
|
|
|
cout <<sum;
|
2024-11-30 10:00:26 +08:00
|
|
|
return 0;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
int count = 0;
|
|
|
|
for (int i = 1; i < 1000; ++i)
|
|
|
|
{
|
|
|
|
if (to_string(i).find('3') != string::npos)
|
|
|
|
{
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cout <<count<<endl;
|
|
|
|
|
2024-11-30 09:44:38 +08:00
|
|
|
return 0;
|
|
|
|
}
|