Continuous Login ZOJ - 3768 (暴力)

STM32 U8g2菜单无限循环滑动:指针数组与缓动动画实现 在嵌入式UI开发中,菜单系统是用户交互的核心组件,尤其对于STM32这类资源受限的MCU。其实现原理通常涉及数据结构管理与图形渲染的协同。通过采用指针数组存储资源,结合循环队列模型,可以在恒定内存开销下管理大量菜单项,这是嵌入式开发中常见的内存优化技术。该技术的核心价值在于,它解决了有限SRAM与丰富UI需求之间的矛盾,实现了高效的数据组织。在此基础上,引入基于整数运算的缓动动画函数,通过线性插值(Lerp)变体实现平滑视觉过渡,避免了浮点运算开销,提升了在无FPU芯片上的运行效率。这种结合数据管理与动画引 阅读详情

Continuous Login

ZOJ - 3768

Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you have not logged in on a certain day, the reward of that day is 0, otherwise the reward is the previous day's plus 1.

On the other hand, Pierre is very fond of the number N. He wants to get exactly N points reward with the least possible interruption of continuous login.


Input

There are multiple test cases. The first line of input is an integer T indicates the number of test cases. For each test case:

There is one integer N (1 <= N <= 123456789).

Output

For each test case, output the days of continuous login, separated by a space.

This problem is special judged so any correct answer will be accepted.

Sample Input
4
20
19
6
9
Sample Output
4 4
3 4 2
3
2 3
Hint

20 = (1 + 2 + 3 + 4) + (1 + 2 + 3 + 4)

19 = (1 + 2 + 3) + (1 + 2 + 3 + 4) + (1 + 2)

6 = (1 + 2 + 3)

9 = (1 + 2) + (1 + 2 + 3)

Some problem has a simple, fast and correct solution.

题意:给你一个数n,要求这个数n只能由(1+2+3+……+k)这样的和组成,求组成n所需要的最小这样的数的个数,输出每个k

思路:这个题一直以为是什么高深的算法,1+2+……+15713就会大于123456789,所以一共就有15712个数,而且发现任意一个数n最多有三个这样的和组成,不会再多了,所以直接暴力一个组成的,两个组成的,三个组成的。

code:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int a[16000],b[1600000];
int cnt;
void init(){
    a[0] = 0;
    cnt = 0;
    for(int i = 1; i < 15713; i++){
        a[i] = a[i-1] + i;
    }
}

int main(){
    init();
    int t;
    int n,flag = 0;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        flag = 0;
        for(int i = 1; i <= 15712; i++){
            if(a[i] == n){//由一个构成
                flag = 1;
                printf("%d\n",i);
                break;
            }
        }
        if(flag) continue;
        for(int i = 1,j = 15712; i <= j;){
            if(a[i] + a[j] < n) i++;
            else if(a[i] + a[j] > n) j--;
            else{//由两个构成
                flag = 1;
                printf("%d %d\n",i,j);
                break;
            }
        }
        if(flag) continue;
        for(int i = 1; i <= 15712; i++){
            for(int j = 1,k = 15712; j <= k;){
                if(a[i] + a[j] + a[k] < n) j++;
                else if(a[i] + a[j] + a[k] > n) k--;
                else{//三个构成
                    flag = 1;
                    printf("%d %d %d\n",i,j,k);
                    break;
                }
            }
            if(flag) break;
        }
    }
    return 0;
}


保姆级教程:从Salmon输出到DESeq2,搞定RNA-seq表达矩阵标准化与下游分析准备 本文提供从Salmon输出到DESeq2标准化的RNA-seq数据分析全流程指南,详细解析表达矩阵构建、标准化方法选择及下游分析准备。重点介绍如何将Salmon定量结果转换为DESeq2兼容格式,包括TPM与原始计数的处理技巧,以及常见问题排查方法,帮助研究人员高效完成RNA-seq数据分析。 阅读详情

相关推荐

Transformer时序预测避坑指南:TFT在风电场的5个实战经验

本文分享了Temporal Fusion Transformer在风电场功率预测中的五个实战经验,涵盖数据预处理、模型调优、显存优化、注意力机制解读及在线部署。针对风电数据噪声大、概念漂移等挑战,提供了从构建数据质量标签到高效超参调优的具体方案,并强调利用Transformer架构的可解释性进行业务洞察,助力实现稳健的工业级时序预测。

bert9linguist的博客 460

第14届浙江大学程序设计竞赛 B. Continuous Login (ZOJ 3768)

【来源】 ZOJ 3768 Continuous Login 【分析】 【源码】 【】

harmony的专栏 922

信创改造实战:SpringBoot项目迁移到宝兰德BES 9.5.5的完整避坑指南(附依赖与web.xml配置)

本文详细介绍了将SpringBoot项目迁移到宝兰德BES 9.5.5的完整流程,包括依赖改造、web.xml配置降级等关键步骤。通过实战案例和避坑指南,帮助开发者高效完成国产中间件适配,确保项目平稳运行。特别针对Tomcat依赖排除和BES适配器选择提供了专业建议。

weixin_30689307的博客 735

ZOJ 3768 Continuous Login

Continuous Login Time Limit: 2 Seconds      Memory Limit: 131072 KB      Special Judge Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a

超越自我就是成功 445

Silvaco TCAD仿真例库——肖特基二极管反向击穿特性(案例)

本文详细解析了使用Silvaco TCAD仿真例库进行肖特基二极管反向击穿特性分析的完整案例。通过构建包含浮空P型保护环的平面结构,重点阐述了针对雪崩击穿仿真的关键步骤,包括高精度网格划分、碰撞电离模型(impact selb)的启用以及反向电压的精细扫描策略。文章深入探讨了漂移区掺杂浓度、保护环设计等参数对击穿电压的影响,并提供了实用的调试心得,旨在帮助工程师精准预测和优化功率肖特基二极管的反向耐压能力。

fire9的博客 724

Sen+MK趋势分析

Sen+MK趋势分析

地理研究与算法的博客 4万+

ZOJ3768-Continuous Login

Continuous Login Time Limit: 2 Seconds      Memory Limit: 131072 KB      Special Judge Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users

wang_128的博客 516

第14.11章 高翔博士最新开源框架Lightning-LM源码解读(十一):离线定位模块全解析,从激光匹配到位姿图优化的极致优化

本文介绍了Lightning-LM离线定位模块的技术架构与实现细节。该模块基于3D激光雷达与IMU融合,采用改进版NDT匹配算法实现高精度定位,具备动态图层更新、多源信息融合等特性。核心流程包括数据预处理、激光里程计处理、IMU预测与点云去畸变、位姿图优化等环节,通过轻量级miao库实现高效增量优化。文章详细解析了模块的代码结构、关键函数功能及数据流,为SLAM系统的开发与优化提供了实践参考。

行知SLAM 375

ZOJ 3768 Continuous Login(暴力或夹逼原理)

参考: http://blog.youkuaiyun.com/zhuhuangjian/article/details/23036139 http://blog.youkuaiyun.com/mid_kkks/article/details/23034401 本题预处理之后,就是一个背包问题,但是容量10e9,不能用背包。最后是判断出最多选择3个数,暴力解决或利用夹逼原理。 夹逼原理:2个数时,利用夹

冰 1524

【数据分析】基于多组学数据整合的微生物与宿主互作网络构建及可视化分析

综上所述,本教程通过详细的步骤和方法,展示了如何整合微生物群落数据、宿主基因表达数据和代谢组数据,构建微生物与宿主互作网络,并进行可视化分析。这种方法为研究微生物与宿主之间的复杂关系提供了一种有力的工具,有助于推动相关疾病的研究和治疗。然而,在实际应用中,需要注意数据处理和分析过程中的各种问题,并结合实验验证来提高研究结果的可靠性和科学性。未来,随着多组学技术的不断发展和完善,以及数据分析方法的创新,相信我们能够更深入地理解微生物与宿主之间的互作机制,为疾病的预防、诊断和治疗提供更有力的支持。

专注生信领域 367

【3D Slicer】的小白入门使用指南一

3D Slicer 是一个免费的开源软件平台,用于医学、生物医学和其他 3D 图像的可视化、处理、分割、配准和分析。Slicer 的功能包括:读/写。

图挖掘领域,新晋砖家 ☞ 未来可期,欢迎和静静一起学习交流吖 5553

ZOJ-3768:Continuous Login(打表找规律+暴力)

ZOJ-3768:Continuous Login(打表找规律+暴力)Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you have not logged in on a ce

Mitsuha_的博客 596

【STM32Cube_14】使用硬件I2C读写环境光强度传感器(BH1750)

本篇详细的记录了如何使用STM32CubeMX配置STM32L431RCT6的硬件I2C外设读取环境光强度传感器数据(BH1750)

Mculover666的博客(嵌入式) 7239

ZOJ Problem Set - 3768 Continuous Login

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3768 打表暴力撸  最多只可能是三个数

可视化和机器学习 835

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ZOJ3768:Continuous Login(二分)

Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you have

ACM!荣耀之路! 2501

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

zoj 3768 Continuous Login

Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you ...

weixin_30609331的博客 125

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

zoj3768Continuous Login

链接 这题通过暴力可以看出最多不超过3 具体为什么。。等着看大牛的题解。 可以预处理出来两个数之和 用bool存下 然后枚举一个数 二分剩余数的位置就可以了 勉强可过 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm...

weixin_30268921的博客 125

ZOJ 3768 Continuous Login

题目链接:ZOJ 3768  Continuous Login 比赛时候

fobdddf的专栏 1288

ZOJ 3768Continuous Login(找规律然后二分)

Continuous Login Time Limit: 2 Seconds      Memory Limit: 131072 KB      Special Judge Pierre is recently obsessed with an online game. To encourage users to log in, this game will give user

布生气 1783

Mancala(模拟)

MancalaMancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. Initially, each hole has $$$a_i$$$ stones. When a player makes a move, he chooses a hole which ...

codeswarrior的博客 1176

ACM-ICPC 2018 南京赛区网络预赛 B The writing on the wall(暴力)

ACM-ICPC 2018 南京赛区网络预赛 B The writing on the wall 这道题不想写了,直接看我队友的写的博客吧,网上其他博客其他方法我也看不懂。。 ACM-ICPC 2018 南京赛区网络预赛 B The writing on the wall code: #include &lt;bits/stdc++.h&gt; using namespace std; t...

codeswarrior的博客 823

Div. 64(简单暴力)

Div. 64Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.Her problem is following: for given string, consisting of only 0 and 1, tell if ...

codeswarrior的博客 787
上一篇: Maximum of Maximums of Minimums CodeForces - 872B(思维)
下一篇: A Simple Problem with Integers POJ - 3468(线段树模板)
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值