【WZOI】AC大礼包(1~150)【已更2023.5.20】

啥也别说了,上答案:

1.Hello World

#include <bits/stdc++.h>
using namespace std;

int main(){
    cout << "Hello World!";
}

2.打印Hello World

#include <bits/stdc++.h>
using namespace std;

int main(){
    cout<<"**************************"<<endl;
    cout<<"         Very    Good!"<<endl;
    cout<<"**************************";
}

3.默写数字

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    cout<<n;
}

4.A+B Problem

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b;
    cout<<a+b<<endl;
}

5.输出第二个整数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<b;
}

6.求一个数的前后两个数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,x;
    cin>>n>>x;
    cout<<n-x<<endl<<n+x<<endl;
}

7.竖式计算

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    printf("%10d\n%4c%6d\n-----------\n%10d",a,'+',b,a+b);
}

8.植树造林

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

9.求自行车总价

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a;
    cin>>a;
    cout<<a*300;
}

10.三位数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int g,s,b;
    cin>>s;
    b=s+1;
    g=b*2;
    cout<<b<<s<<g;
}

11.做蛋糕

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a1,a2,a3,b1,b2,b3;
    cin>>a1>>a2>>a3>>b1>>b2>>b3;
    cout<<a1*b1+a2*b2+a3*b3<<endl;
}

12.计算(a+b)*c的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b)*c;
}

13.求余数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a%b;
}

14.计算(a+b)/c的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b)/c;
}

15.小玉买文具

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a*10+b)/19;
}

16.买苹果

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a;
    cout<<(a/3)*4+a%3;
}

17.买牛奶

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<d/a*a/b*c+(d/a);
}

18.小鱼的游泳时间

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<((c-a)*60+d-b)/60<<" "<<((c-a)*60+d-b)%60;
}

19.周长与面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<"perimeter="<<(a+b)*2<<endl<<"area="<<a*b;
}

20.求筝形面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long a,b;
    cin>>a>>b;
    cout<<a*b;
}

21.求正立方体表面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a;
    cin>>a;
    cout<<a*a*6;
}

22.输出保留3位小数的浮点数

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<x;
}

23.工资

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,b,c,s;
	cin>>a>>b>>c;
	s=b*c;
	cout<<"NUMBER = "<<a<<endl<<"SALARY = U$ ";
	printf("%0.2lf",s);
	return 0;
}

24.四舍五入

#include <bits/stdc++.h>
using namespace std;

int main(){
    int y;
    double x;
    cin>>x>>y;
    cout<<fixed<<setprecision(y)<<x;
}

25.求梯形面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b,c;
    cin>>a>>b>>c;
    cout<<fixed<<setprecision(2)<<(a+b)*c/2;
}

26.梯形面积

#include <bits/stdc++.h>
using namespace std;

int main(){   
    double a;
    cout<<fixed<<setprecision(2)<<160.0*2/15*(15+25)/2;
}

27.求圆柱体表面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    double r,h;
    cin>>r>>h;
    cout<<fixed<<setprecision(2)<<2*(3.14*r*r)+2*(3.14*r*h);
}

28.计算总成绩与平均成绩

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<fixed<<setprecision(2)<<a+b+c+d<<endl<<(a+b+c+d)/4;
}

29.新平均成绩

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x,score,n;
    cin>>x>>score>>n;
    cout<<fixed<<setprecision(3)<<(x*n-score)/(n-1);
}

30.歌手大奖赛

#include <bits/stdc++.h>
using namespace std;

int main(){
    double score;
    printf("%6.2lf",((9.6*6)-((9.6*12)-(9.4*5)-(9.8*5)))/4);
}

31.奇葩的饭店

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b;
    cin>>a>>b;
    cout<<fixed<<setprecision(4)<<b/(a/100);
}

32.猜数游戏

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x;
    cin>>x;
    cout<<(x*1000+x)/7/11/13;
}

33.求根号x的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<sqrt(x);
}

34.求logx

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<log(x)<<endl<<log10(x)<<endl<<log2(x);
}

35.求两者较大值的max函数的用法

#include <bits/stdc++.h>
using namespace std;

int main(){
    char c;
    int a,b;
    cin>>a>>c>>b;
    cout<<"max="<<max(a,b);
}

36.求自行车和三轮车各是多少辆

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a*3-b)/(3-2)<<" "<<(b-a*2)/(3-2);
}

37.鸡兔同笼

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x,y,m,n;
    cin>>x>>y;
    cout<<(x-(y*2))/(4-2)<<" "<<((y*4)-x)/(4-2);
}

38.计算路程

#include <bits/stdc++.h>
using namespace std;

int main(){
    double v,t;
    cin>>v>>t;
    cout<<fixed<<setprecision(2)<<v*t;
}

39.带余除法

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b;
}

40.交换门牌号


                
### WZOI (600 to 650) 技术信息或问题 根据已知的信息,WZOI 是一个在线编程竞赛平台,提供不同难度级别的题目供参赛者解决。以下是关于该范围内可能涉及的技术内容和问题的分析。 #### 可能的技术内容 1. **动态规划优化** 动态规划问题是常见的算法挑战之一,在此区间内的题目可能涉及到状态压缩、记忆化搜索等高级技巧[^1]。例如,对于给定的状态转移方程,如何通过减少冗余计算来提高效率是一个重要方向。 2. **图论中的复杂结构处理** 图论问题通常出现在这一分数段中,比如最小生成树、网络流以及强连通分量等问题。这些问题往往需要深入理解数据结构的应用场景及其性能特点[^2]。 3. **字符串匹配与模式识别** 字符串操作也是高频考点之一,特别是在较高难度级别上。KMP算法、Manacher算法或者AC自动机可能是解题的关键工具[^4]。 #### 解决方案示例 下面给出一段针对特定条件下的伪代码实现框架: ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; // 输入天数n vector<int> rec(n); for(auto &x : rec){ cin>>x; //读取每天推荐类别 } // 初始化noip, shengxuan未看题目集合 set<int> noip_set, sx_set; for(int i=1;i<=N_NOIP;i++) noip_set.insert(i); for(int j=1;j<=N_SX;j++) sx_set.insert(j); long total_score =0; string action; while(cin>>action && !noip_set.empty() || !sx_set.empty()){ if(action=="READ"){ char type; cin>>type;// 'N'表示NOIP,'S'表示省选 if(type=='N'){ auto it=noip_set.begin(); int q=*it; noip_set.erase(it); if(rec[current_day]=='N')total_score+=10; else total_score +=5; } else{ auto jt=sx_set.begin(); int p=*jt; sx_set.erase(jt); if(rec[current_day]=='S')total_score+=10; else total_score +=5; } }else{ //"WRITE" //逻辑同理... } } } ``` 上述代码片段展示了基于阅读/写作行为调整得分策略的一种方法。 #### 注意事项 - 对于某些特殊边界情况要格外小心测试,确保程序鲁棒性良好。 - 时间复杂度需严格控制在允许范围内,避免因超时而导致丢分。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值