第一题 hello,acmer
直接输出题,不用考虑什么
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
char a = '"';
printf("%cHello ACMer,welcome!%c",a,a);
}
第二题 更加更加欢迎acm新生
来自去年第一次周测,由于学长比较懒直接拉过来了,面向样例编程,一行一行复制就行
#include<stdio.h>
int main ( ){
printf(" | /## /## /### /## /########## /############ |\n");
printf(" | | ## | ## | #### | ## |___ ##___/ |_____ ##____/ |\n");
printf(" | | ## | ## | ## ## | ## | ## | ## |\n");
printf(" | | ## | ## | ## ## | ## | ## | ## |\n");
printf(" | | ########### | ## ## | ## | ## | ## |\n");
printf(" | | ## | ## | ## ##| ## | ## | ## |\n");
printf(" | | ## | ## | ## ## ## | ## | ## # ##### # # |\n");
printf(" | | ## | ## | ## #### | ## | ## # # ## ## ## |\n");
printf(" | | ## | ## | ## |### /########## | ## ##### ## # # # # |\n");
printf(" | |__/ |__/ |__/ |__/ |__________/ |__/ # # ##### # # # |\n");
}
第三题 简单的活动
注意看文章一句话可以从第i个山峰跳到第j座山峰当且仅当i<j且hi<hj,题目需要我们从第一到最后一个,所以方案最优的话就是找第一个直接能不能到最后一个就是h1<hn
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int n;
scanf("%d", &n);
ll x , y , a;
for(int i=1;i<=n;i++){
scanf("%lld",&a);
if(i == 1)
x = a;
if(i == n)
y = a;
}
if(x<y)
cout<<"YES";
else
cout<<"NO";
}
第四题 派派派
在一行中,将 pi 的值从小数点后第 L 位打印到第 R 位小数。简单处理一下就行
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll s=141592653589793;
int l,r;cin>>l>>r;
int len=r-l+1;r=15-r;
ll tmp1=1,tmp2=1;
while(len--)
{
tmp1*=10;
}
while(r--)
{
tmp2*=10;
}
cout<<(s/tmp2)%tmp1;
}
第五题 喜欢吃瓜的人们
签到题直接写就行
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int c;
scanf("%d",&c);
if(c==2){
printf("NO, you can't divide the watermelon into two even parts.");
return 0;
}
if(!(c&1)){
printf("YES, you can divide the watermelon into two even parts.");
}else{
printf("NO, you can't divide the watermelon into two even parts.");
}
}
第六题 活着的小a
在循环里面直到输入.就退出,碰到字符a答案加一最后输出即可
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
char a;
int ans = 0;
scanf("%c",&a);
while(a!='.'){
if(a=='a'){
ans++;
}
scanf("%c",&a);
}
printf("%d",ans);
}
第七题 奈彼玩原神
相信大家刚刚高考完对于期望也是非常会的
题目分析
由上方定义可以类比出:
第二次猜中是在第一次没猜中的情况下
第i次猜中的前提都是前i-1次没猜中
第一次没猜中 0.8概率(4/5)
第二次猜中 0.25概率(1/5)
第二次猜中的前提是第一次没猜中
由题知:先猜在哪个组 再一个一个猜
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
printf("32");
}
第八题 二进制转换
二进制一直除二一直到零位置,每次把答案加一即可
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int n,cnt=0;
scanf("%d",&n);
while(n)
{
n/=2;
cnt++;
}
printf("%d",cnt);
}
第九题 字符菱形
专题里写过不做解答
第十题 平方差数
思维题,简答思考一下可以得到只有对2取余得到1,或者是4的倍数都可以是平方差数
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int t;
scanf("%d",&t);
while(t--){
int x;
scanf("%d",&x);
if(x%2==1||x%4==0)printf("YES\n");
else printf("NO\n");
}
return 0;
}