叉姐的魔法训练(第六课)---- 暴雨术入门

挖坑...

--------------------------------

一 小学奥数

HDU 4103 Clock

火星有A小时B分钟,一天有多少次分针超过时针θ呢。

当然是A-1次啦。

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
const double eps=1e-9;
int main()
{
    int A,B;
    double t;
    while ((~scanf("%d%d%lf",&A,&B,&t))&&(A!=0||B!=0||fabs(t)>eps)){
        printf("%d\n",A-1);
    }
    return 0;
}

--------------------------------

二 贪心计数

HDU 4104 Discount

将输入a[]从小到大排序。

从小到大累加,当a[i]>sum+1时答案就找到啦。

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
const int maxn=1111;
int n;
int a[maxn];
int main()
{
    while (~scanf("%d",&n)){
        for (int i=1;i<=n;i++){
            scanf("%d",&a[i]);
        }
        int sum=0;
        for (int i=1;i<=n;i++){
            if (a[i]>sum+1){
                sum+=1;
                break;
            }
            sum+=a[i];
        }
        sum+=1;
        printf("%d\n",sum);
    }
    return 0;
}

--------------------------------

三 卡时线段

HDU 4107 Gangster

一个数组和一个数p。数组的每一个元素都为0.
然后进行m次操作。
每次操作给l,r和c。如果l和r区间的数小于p就加c否则加2*c。

--------------------------------

--------------------------------

--------------------------------

--------------------------------

--------------------------------


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值