浏览器标题切换
浏览器标题切换end

CodeForces379A - New Year Candles - 暴力

题意

给出ab,表示有a根蜡烛。

每当点燃一根蜡烛,只燃烧一个小时,但是可以把b根燃尽的蜡烛拼接成一根新的蜡烛,

输出最多能让房间亮几个小时。

思路

这题只有1000分……
直接暴力就行,
但是我总有部分数据错……

AC代码

#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<list>
#include<stdlib.h>
#include<map>
#include<stack>
#include<stdio.h>
#include<queue>
using namespace std;
typedef long long ll;
#define sc(T) scanf("%d",&T)
#define scc(x,y) scanf("%d %d",&x,&y)
#define pr(T) printf("%d\n",T)
#define f(a,b,c) for (int a=b;a<c;a++)
#define ff(a,b,c) for (int a=b;a>c;a--)
#define inf 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define eps 1e-9
#define PI acos(-1)

int main()
{
    int x,y;
    scc(x,y);
//    int ans=x,mod=0;
    int ans=0,mod=0;
    while(x)
    {
//        ans=ans+x/y;
//        mod=mod+x%y;
//        x=x/y;

        ans+=x;
        mod+=x;
        x=mod/y;
        mod=mod%y;
    }
    ans=ans+mod/y;
    pr(ans);
    return 0;
}
posted @   抓水母的派大星  阅读(142)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
历史上的今天:
2019-09-26 HDU1850 - Being a Good Boy in Spring Festival - Nim博弈
2019-09-26 LightOJ1253 - Misere Nim - Nim博弈
点击右上角即可分享
微信分享提示