状态比上次好点,但还是不理想。
A-Batting Average
超级大水题之你只要会编程就会做。
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
inline ll re(){
ll k=0,f=1;
char cre=getchar();
while(!('0'<=cre&&cre<='9')){
if(cre=='-') f=-1;
cre=getchar();
}
while('0'<=cre&&cre<='9'){
k=k*10+(cre^48);
cre=getchar();
}
return 1ll*k*f;
}
void wr(ll x){
if(x<0){
putchar('-');
x=~x+1;
}
if(x>9) wr(x/10);
putchar(x%10^48);
}
signed main(){
double a,b;
cin>>a>>b;
printf("%.3lf",b/a);
return 0;
}
B-Line Sensor
在输入中,对每一列 j j j 的答案加一,当且仅当字符 c(i,j)='#'
。
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int h,w;
inline ll re(){
ll k=0,f=1;
char cre=getchar();
while(!('0'<=cre&&cre<='9')){
if(cre=='-') f=-1;
cre=getchar();
}
while('0'<=cre&&cre<='9'){
k=k*10+(cre^48);
cre=getchar();
}
return 1ll*k*f;
}
void wr(ll x){
if(x<0){
putchar('-');
x=~x+1;
}
if(x>9) wr(x/10);
putchar(x%10^48);
}
int ans[1005];
signed main(){
h=re(),w=re();
for(int i=1;i<=h;++i){
for(int j=1;j<=w;++j){
char c;
cin>>c;
if(c=='#') ans[j]++;
}
}
for(int i=1;i<=w;++i) cout<<ans[i]<<' ';
return 0;
}
C-Ameba
设 a n s [ x ] ans[x] ans[x] 为 x x x 与 1 1 1 的隔代数,首先 a n s [ 1 ] = 0 ans[1]=0 ans[1]=0。接下来对每次输入的 A i A_i Ai,都会有: a n s [ 2 i ] = a n s [ 2 i + 1 ] = a n s [ A i ] + 1 ans[2i]=ans[2i+1]=ans[A_i]+1 ans[2i]=ans[2i+1]=ans[A