牛客小白月赛21解题报告

2022-08-15 12:38:46 浏览数 (1)

namo 怎么ak一场小白月赛这么难啊

比赛链接 除了代码短度一无是处了

Audio

找外心

代码语言:javascript复制
#include<bits/stdc  .h>
using namespace std;
double x1,y11,x2,y2,x3,y3,x,y;
int main(){
    cin>>x1>>y11>>x2>>y2>>x3>>y3;
    double A1=2*(x2-x1),B1=2*(y2-y11),C1=x2*x2 y2*y2-x1*x1-y11*y11;
    double A2=2*(x3-x2),B2=2*(y3-y2),C2=x3*x3 y3*y3-x2*x2-y2*y2;
    x=((C1*B2)-(C2*B1))/((A1*B2)-(A2*B1));
    y=((A1*C2)-(A2*C1))/((A1*B2)-(A2*B1));
    printf("%.3lf %.3lfn",x,y);
}
Bits
代码语言:javascript复制
#include<bits/stdc  .h>
#define rep(i,s,e) for(int i=s; i<e;   i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
using namespace std;
int n,t[5],s[15][5];
void print(){
    rep(i,1,3*(2*n 1) 5) putchar('.');
    putchar('n'); dep(i,n 1,1){
        rep(j,1,4){
            rep(k,0,n-s[i][j] 1) putchar('.');
            rep(k,0,s[i][j]) putchar('*');
            putchar(s[i][j]?'*':'|');
            rep(k,0,s[i][j]) putchar('*');
            rep(k,0,n-s[i][j]) putchar('.');
        } putchar('.'); putchar('n');
    }
}
void move(int a,int b){
    s[  t[b]][b]=s[t[a]][a]; s[t[a]--][a]=0;
    rep(i,1,3*(2*n 1) 5) putchar('-');
    putchar('n'); print();
}
void solve(int n,int a,int b,int c){
    if(n==1) return move(a,c);
    solve(n-1,a,c,b); move(a,c);
    solve(n-1,b,a,c);
}
int main(){
    cin>>n; rep(i,1,n 1) s[  t[1]][1]=n-i 1;
    print(); solve(n,1,2 (n&1),3-(n&1));
}
Channels
代码语言:javascript复制
#include<bits/stdc  .h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b; while(cin>>a>>b) cout<<b/60*50 min(50ll,b`)-(a-1)/60*50-min(50ll,(a-1)`)<<'n';
}
DDoS
代码语言:javascript复制
#include<bits/stdc  .h>
#define pf printf
#define sc(x) scanf("%d", &x)
using namespace std;
const int maxn = 1e5   5;
int in[maxn],vis[maxn];
vector<int>vv[maxn];
int main(){
    int n,m; sc(n); sc(m); while(m--){
        int u,v,w; sc(u); sc(v); sc(w);
        vv[u].push_back(v); in[v]  ;
    } vis[1]=1; queue<int>q; q.push(1);
    while(!q.empty()){
        int fr=q.front(); q.pop(); for(int t:vv[fr]){
            vis[t]=(vis[t] vis[fr]) 010905;
            if(!--in[t]) q.push(t); 
        }
    } pf("%dn",vis[n]);
}
Exams
代码语言:javascript复制
#include<bits/stdc  .h>
int main(){
    int n; double a1(0),a2(0); std::cin>>n; while(n--){
        int a; double b,c,d,e,f,g,h; std::cin>>a>>b>>c>>d>>e>>f>>g>>h;
        if(a==2) continue; a1 =b*(int)(c*d e*f g*h 0.5); a2 =b;
    } printf("%.2lf",a1/a2);
}
Fool Problem
代码语言:javascript复制
#include<bits/stdc  .h>
using namespace std;
int main(){
    string s; cin>>s; puts((s[s.size()-1]-'0')&1?"-1":"1");
}
Game
代码语言:javascript复制
#include<bits/stdc  .h>
#define rep(i,s,e) for(int i=s; i<e;   i)
int main(){
    int n,cnt(0); std::cin>>n;
    rep(i,2,n 1) while(n%i==0) n/=i,cnt  ;
    puts(cnt&1?"Nancy":"Johnson");
}
”Happy New Year!“

php

代码语言:javascript复制
"Happy New Year!"
I love you
代码语言:javascript复制
#include<bits/stdc  .h>
#define rep(i,s,e) for(int i=s; i<e;   i)
using namespace std;
int a[10],mod=20010905;
int main(){
    string s,q=" iloveyou"; a[0]=1; cin>>s;
    int len=s.length(); rep(i,0,len){
        s[i]=tolower(s[i]);
        rep(j,1,9) a[j]=(a[j] (s[i]==q[j])*a[j-1])%mod;
    } cout<<a[8];
}
Jelly

我真的服了 这都能wa

代码语言:javascript复制
#include<bits/stdc  .h>
#define rep(i,s,e) for(int i=s; i<e;   i)
using namespace std;
char mp[105][105][105];
int dir[6][3]={1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1};
struct node{
    int x,y,z,cnt;
};
int n,cnt;
int vis[105][105][105];
queue<node>q;
int bfs(){
    q.push(node{0,0,0,1}); vis[0][0][0]  ; while(!q.empty()){
        node fr=q.front(); q.pop(); rep(i,0,6){
            node c=fr; c.x =dir[i][0],c.y =dir[i][1],c.z =dir[i][2];
            if(c.x<0||c.y<0||c.z<0||c.x>=n||c.y>=n||c.z>=n) continue;
            if(vis[c.x][c.y][c.z]||mp[c.x][c.y][c.z]=='*') continue;
            vis[c.x][c.y][c.z]  ; c.cnt  ; q.push(c);
            if(c.x==n-1&&c.y==n-1&&c.z==n-1) return cout<<c.cnt,0;
        }
    } return cout<<-1,0;
}
int main(){
    cin>>n; rep(i,0,n) rep(j,0,n) cin>>mp[i][j]; bfs();
}

0 人点赞