第 45 届国际大学生程序设计竞赛(ICPC)亚洲网上区域赛模拟赛

第 45 届国际大学生程序设计竞赛(ICPC)亚洲网上区域赛模拟赛

A Easy Equation

#include <bits/stdc++.h>

#define int ll
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;

void solve() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int sum=min(a+b,d),ans=0;
    for (int i = 0; i <= sum; ++i) {
        ans+=(min(a,i)-max(i-b,0ll)+1)*(min(d-i,c)+1);
    }
    cout<<ans<<"\n";
}

signed main() {
    //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1;
//    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

B XTL’s Chessboard

#include <bits/stdc++.h>

#define int ll
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;

void solve() {
    cout<<2;
}

signed main() {
    //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1;
//    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

D Pokemon Ultra Sun

#include <bits/stdc++.h>

#define int ll
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const int maxn = 3e3 + 10;

double dp[maxn][maxn];

void solve() {
    int hp1, hp2, w;
    double p;
    cin >> hp1 >> hp2 >> w >> p;
    memset(dp,0,sizeof(dp));
    for (int i = 1; i <= hp1; ++i) {
        for (int j = 1; j <= hp2; j++) {
            dp[i][j] = dp[max(0ll,i-w)][j]*(1-p) + dp[i][max(j-w,0ll)]*p+1.0;
        }
    }
    printf("%.6f\n",dp[hp1][hp2]);
}

signed main() {
    //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值