• 2019.11.10考试解题报告


    2019.11.10考试解题报告

    总结

    期望得分:(50 + 100 + 0 = 150)
    实际得分:(20 + 70 + 0 = 90)

    (T1)找到了(50)分的规律,然而模数取错了,(T2)找出了正解,但是数组开小了,(T3)不会


    思路&&代码

    T1

    找规律

    #include<iostream>
    #include<cstdio>
    #include<ctype.h>
    using namespace std;
    const int mod=1e9+7;
    inline int read() {
    	int x=0,f=0;
    	char ch=getchar();
    	while(!isdigit(ch))f|=ch=='-',ch=getchar();
    	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
    	return f?-x:x;
    }
    inline int Fast_pow(int b,int p,int ans=1) {
    	while(p) {
    		if(p&1)ans=1ll*ans*b%mod;
    		b=1ll*b*b%mod;
    		p>>=1;
    	}
    	return ans;
    }
    int main() {
    	int n=read()-1,k=read(),ans,nn=1ll*n*n%mod;
    	int a=1ll*(Fast_pow(nn,k/2)-1+mod)%mod*Fast_pow(nn-1,mod-2)%mod;
    	int b=1ll*n*(Fast_pow(nn,(k-1)/2)-1+mod)%mod*Fast_pow(nn-1,mod-2)%mod;
    	if(k&1)ans=(b-a+mod)%mod;
    	else ans=(a-b+mod)%mod;
    	printf("%d
    ",1ll*ans*Fast_pow(Fast_pow(n,k-1),mod-2)%mod);
    	return 0;
    }
    

    T2

    k等于1

    #include <cmath>
    #include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    #define FOR(i, x, y) for(int i = x; i <= y; i++)
    #define QWQ(i, x, y) for(int i = x; i >= y; i--)
    using namespace std;
    
    const int A = 1e3 + 11;
    const int B = 1e6 + 11;
    const int inf = 0x3f3f3f3f;
    
    inline int read() {
    	char c = getchar();
    	int x = 0, f = 1;
    	for( ; !isdigit(c); c = getchar()) if(c == '-') f = -1;
    	for( ; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
    	return x * f;
    }
    
    struct node {
    	int w, v;
    } box[A];
    
    int a, b, m, K, cnt;
    int f[301][301][51];
    
    int main() {
    	freopen("b.in", "r", stdin);
    	freopen("b.out", "w", stdout);
    	a = read(), b = read(), m = read(), K = read();
    	if(a == 0 && b == 0) return puts("0"), 0;
    	if(m == 0) return puts("Impossible"), 0;
    	for(int i = 1; i <= m; i++) box[i].w = read(), box[i].v = read(), cnt += box[i].w;
    	if(cnt < a + b) return puts("Impossible");
    	memset(f, inf, sizeof(f));
    	if(m <= 50 && a <= 50 && b <= 50);
    	else K = min(1, K);
    	f[0][0][0] = 0;
    	FOR(i, 1, m) QWQ(j, a, 0) QWQ(k, b, 0) QWQ(w, K, 0) {
    		if(box[i].w >= 2 && j && k && w) f[j][k][w] = min(f[j - 1][k - 1][w - 1] + box[i].v, f[j][k][w]);
    		f[j][k][w] = min(f[j][k][w], f[max(0, j - box[i].w)][k][w] + box[i].v);
    		f[j][k][w] = min(f[j][k][w], f[j][max(0, k - box[i].w)][w] + box[i].v);
    	}
    	int ans = inf;
    	for(int k = 0; k <= K; k++) ans = min(ans, f[a][b][k]);
    	cout << ans << '
    ';
    	return 0;
    }
    
    

    T3

    不会

  • 相关阅读:
    autodl3配置深度学习环境
    autodl使用2配置环境
    20220723图生成模型腾讯AI徐挺洋老师(分子生成)
    加班
    打比赛
    错过了一个比较大的编程比赛
    胡思乱想
    没有太复杂
    张远陆虎给从前的自己
    我还是会想
  • 原文地址:https://www.cnblogs.com/loceaner/p/11837090.html
Copyright © 2020-2023  润新知