CSUFT 个人赛(2) C题(POJ - 1316) D题(HDU - 2076) G题(HihoCoder - 1740) H题(HDU - 5640)

Firefox无头模式完全指南:从原理到生产避坑 无头浏览器是现代自动化测试与数据采集的核心技术,其本质是绕过图形界面栈,在内存中完成HTML解析、CSS布局、JavaScript执行与DOM操作。Firefox凭借Gecko引擎的原生headless backend,相比Chrome在资源占用、启动速度和CI/CD兼容性上具备独特优势,但需严格区分`--headless=remote`与旧式`--headless`语义差异。该技术广泛应用于服务器端爬虫、后台UI测试及高并发自动化场景,尤其适合Docker容器、Jenkins流水线等无显示环境。本文聚焦S 阅读详情

其实 今天个人赛打得不好emmm

出了很多小差错...

在下面的内容里会好好分析


        C题  原题地址 (POJ - 1316)

In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for digitadition, a term coined by Kaprekar.) For example, d(75) = 75 + 7 + 5 = 87. Given any positive integer n as a starting point, you can construct the infinite increasing sequence of integers n, d(n), d(d(n)), d(d(d(n))), .... For example, if you start with 33, the next number is 33 + 3 + 3 = 39, the next is 39 + 3 + 9 = 51, the next is 51 + 5 + 1 = 57, and so you generate the sequence 

33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, ... 
The number n is called a generator of d(n). In the sequence above, 33 is a generator of 39, 39 is a generator of 51, 51 is a generator of 57, and so on. Some numbers have more than one generator: for example, 101 has two generators, 91 and 100. A number with no generators is a self-number. There are thirteen self-numbers less than 100: 1, 3, 5, 7, 9, 20, 31, 42, 53, 64, 75, 86, and 97. 

Input
No input for this problem.
Output
Write a program to output all positive self-numbers less than 10000 in increasing order, one per line.
Sample Input
Sample Output
1
3
5
7
9
20
31
42
53
64
 |
 |       <-- a lot more numbers
 |
9903
9914
9925
9927
9938
9949
9960
9971
9982
9993


暴力题  

某个数的各个位上的数字之和加上其本身的数 不能叫做子数  求10000以内所有的子数 (垃圾翻译)

第一遍写的时候 分类讨论 1~9  10~99  100~999  1000~9999

写了好多个循环来做不同位数的处理

交题之后 果断超时了...

又想了想 不是可以直接 考虑1~9999 将个位、十位、百位、千位上的数字取出来 再进行运算

上代码:

#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    int n,m[10010];
    int a,b,c,d;
    for (int i=1; i<10000; i++)
        m[i]=i;
    for (int i=1; i<10000; i++)
    {
        a=i%10;
        b=i/10%10;
        c=i/100%10;
        d=i/1000;
        m[a+b+c+d+i]=0;
    }
    for (int i=1; i<10000; i++)
        if (m[i]>0)
            printf("%d\n",m[i]);
    return 0;
}


接下来 

    D题  原题地址 (HDU - 2076)

时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少。现在xhd知道的只有时间,请你帮他算出这个夹角。 

注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的。 
Input输入数据的第一行是一个数据T,表示有T组数据。 
每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时、分、秒。
Output对于每组输入数据,输出夹角的大小的整数部分。 
Sample Input
2
8 3 17
5 13 30
Sample Output
138
75

数学题  按照公式来就行

x 记录时针从0开始转过的角度

y 记录分针从0开始转过的角度

两者相减  如果该值大于180 则需要用360减去该值

同时要 注意 输入的h 大于12时 需要减去12 (相当于时针多走了一圈)

最后 输出的时候要取整数部分

这道题 在比赛的时候WA了5次 真的心态炸裂

比赛结束后 又交了好几遍去找 WA的点


其实真的是很小的一个注意点

double 型的数据在乘除的时候要带上小数点!!!

尤其是除法的时候!!!

上代码  (fabs()是对double 或是 float 类型的数取正值)

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int n,a,b,c;
    double m,k,x,y;
    scanf("%d",&n);
    for (int i=0; i<n; i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        x=(a%12)*30+b*0.5+c*0.5/60;
        y=b*6+c*0.1;
        m=fabs(x-y);
        if (m>180)
            m=360-m;
        printf("%d\n",(int)m);
    }
    return 0;
}


G题 原题地址  (HihoCoder - 1740)

已知替换函数replace(c1, c2)的作用是把一个字符串中所有的c1字符替换成c2字符。  

请你判断能否使用replace函数将字符串S变成D。  

你可以调用replace函数任意多次。

Input

输入包含多组数据。  

第一行包含一个整数T,代表数据组数。  

每组数据包含两行,分别是字符串S和D。

1 ≤ T ≤ 10

S和T都只包含小写字母,且1 ≤ |S| = |D| ≤ 1000

Output

对于每组数据输出YES或者NO,表示能否使用replace函数将字符串S变成D。

Sample Input
2  
aaabb  
ccccc  
aaabbbbb  
cccccddd
Sample Output
YES  
NO

在代码里放解释吧...

写这题的时候脑子有点乱

结果 数组只开了50 (我也不知道为啥)

比赛结束之后 重新开了数组就过了 也是水题

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string.h>
#include <algorithm>
using namespace std;
char a[2000],b[2000];
int x[2000],y[2000];
bool flag;
int main()
{
    int n;
    scanf("%d",&n);
    for (int i=0; i<n; i++)
    {
        flag=true;
        memset(x,0,sizeof x);//x数组 清零
        memset(a,' ',sizeof a);//清空a数组
        memset(b,' ',sizeof b);//清空b数组
        scanf("%s",a);
        scanf("%s",b);
        int len1=strlen(a);
        int len2=strlen(b);
        if (len1!=len2) //判断两个字串是否长度相等
            flag=false;
        for (int j=0; j<len1-1; j++)
            for (int k=j+1; k<len1; k++)
                //如果 a数组中 某一个字符 和 后一个字符 相同
                //那么 他们对应的b数组中相同位置的字符也应该相同
            {
                if (a[j]==a[k]&&b[j]!=b[k])
                    flag=false;
            }
        if (flag)
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


     H题  原题地址 (HDU - 5640)

It is the king's birthday before the military parade . The ministers prepared a rectangle cake of size  n×m(1≤n,m≤10000)n×m(1≤n,m≤10000) . The king plans to cut the cake himself. But he has a strange habit of cutting cakes. Each time, he will cut the rectangle cake into two pieces, one of which should be a square cake.. Since he loves squares , he will cut the biggest square cake. He will continue to do that until all the pieces are square. Now can you tell him how many pieces he can get when he finishes.
InputThe first line contains a number  T(T≤1000)T(T≤1000), the number of the testcases. 

For each testcase, the first line and the only line contains two positive numbers  n,m(1≤n,m≤10000)n,m(1≤n,m≤10000).OutputFor each testcase, print a single number as the answer.Sample Input
2
2 3
2 5
Sample Output
3
4

hint:
For the first testcase you can divide the into one cake of $2\times2$ , 2 cakes of $1\times 1$


思路:因为蛋糕都是正方形的 所以每次都是切 长或宽 的较小值 才能取到最大的蛋糕

先判断 长宽的大小 然后做循环处理

上代码:

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int n,a,b,sum;
    scanf("%d",&n);
    for (int i=0; i<n; i++)
    {
        sum=0;
        scanf("%d%d",&a,&b);
        if (a<b)
        {
            a=a+b;
            b=a-b;
            a=a-b;
        }
        while (b>0)
        {
            a=a-b;
            sum++;
            if (a<b)
            {
                a=a+b;
                b=a-b;
                a=a-b;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

继续加油啊~

HDU--杭电--2076--夹角有多大(题目已修改,注意读题)--水题 夹角有多大(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7706    Accepted Submission(s): 3069 Problem Description 时间过的好快,一 阅读详情

相关推荐

PX4实战指南:通过遥控器通道映射实现多舵机PWM精准控制

本文详细介绍了通过PX4飞控的AUX PWM接口实现遥控器通道映射控制多舵机的实战指南。内容包括硬件选型与连接、软件参数配置、通道映射方法以及常见问题排查,帮助开发者精准实现无人机舵机PWM控制,适用于云台、机械臂等扩展功能开发。

ee345的博客 304

hdu-1128 自私的数

Self Numbers In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d

Rainbow__sea的博客 408

补洞与fairing算法

对网格进行补洞,remesh, 平滑,fairing, 最小二乘优化平滑

闪电彬彬的博客 1047

(ZJU-2005复试)-HDOJ-1180-Self Numbers

 Self Numbers Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1927    Accepted Submission(s): 828  Problem DescriptionIn 1949

轻疯 清风 1215

22版本Altium Designer导出生产文件的规范化操作指南

本文详细介绍了PCB设计中的Gerber文件导出流程及相关文件生成方法。主要内容包括:1)Gerber文件导出的5个关键设置步骤;2)NC钻孔文件的导出方法;3)坐标文件的生成方式;4)文件打包规范要求必须包含Gerber文件、NC钻孔文件和坐标文件;5)文件提交的两种方式(新手推荐提交原始工程文件,量产推荐仅提交Gerber文件包)。文章还特别强调了单位一致性、精度验证等注意事项,为PCB设计文件的规范输出提供了完整指导。

qq_56506325的博客 1055

3D点云修复实战:用PCN网络快速补全缺失的激光雷达数据(附代码)

本文详细介绍了PCN(Point Completion Network)网络在3D点云修复领域的实战应用。针对激光雷达数据常见的缺失问题,PCN通过端到端的深度学习架构,直接处理原始点云,实现由粗到精的快速补全。文章深入解析了其核心思想与编码器-解码器架构,并提供了完整的环境搭建、数据准备、模型实现、训练评估及在真实场景下的优化策略与代码示例,为自动驾驶、机器人等领域的开发者提供了高效的数据修复解决方案。

weixin_29041195的博客 392

ACM模拟题详解(2)——简单数论

有很多与数字相关的题目,主要考察基本的编程能力,如果数学比较好,对于解决这些问题有比较好的帮助。

李绪成的一亩三分地 3135

OpenCV计算机视觉实战(12)——图像金字塔与特征缩放

图像金字塔技术通过对原始图像按不同分辨率进行多层次表示,不仅能提升计算效率,还能为图像融合、检测与识别提供多尺度特征。高斯金字塔 (Gaussian Pyramid) 用于构建多级低通图像,拉普拉斯金字塔 (Laplacian Pyramid) 则提取各层之间的细节信息。本节将深入介绍如何使用 OpenCV 构建高斯与拉普拉斯金字塔,并以经典的图像融合案例,展示图像金字塔在特征缩放与融合中的强大应用。

qq_30167691的博客 1404

hoj 1087 Self Numbers

In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for dig

GadyPu的专栏 510

华为OD机试真题 新系统 2026-08-16 Python&JS【智能家居模式调度优化】

智能家居系统中有多个自动化联动模式,每个模式 modes[i]=[start_time,end_time,power],表示它在左闭右开区间 [start_time,end_time) 内持续消耗固定功率 power。

MISAYAONE的博客 85

【专栏必读】王道考研408数据结构+算法设计与分析万字笔记使用说明及章节导航

各位老铁思维导图在我整理完笔记后会放上去的,我需要根据王道的思维导图重新再做一遍 文章目录一:有关注意事项二:关于专栏三:学习建议四:各专栏导航(各位老铁别催,质量优先)(1)第一章:绪论(2)第二章:线性表(3)第三章:栈和队列第四章:串第五章:二叉树第六章:图 首先感谢王道大大(手动比心),很用心在做了,大家可以看其中两节是否符合胃口 (王道408考研数据结构)第五章树-第三节1:二叉树遍历(先序、中序和后序) (王道408考研数据结构)第五章树-第四节2:平衡二叉树(AVL)及其旋转 一:有.

快乐江湖的博客 5万+

Self Numbers(POJ 1316)

Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d st...

qq_43063278的博客 301

组建高效AI开发团队:角色、技能与协作

在当今科技飞速发展的时代,人工智能(AI)已经成为各个领域的核心驱动力。组建高效的AI开发团队对于企业和科研机构来说至关重要,它能够推动创新、提高竞争力、实现业务目标。本文的目的在于为那些希望组建或优化AI开发团队的管理者、技术负责人以及相关从业者提供全面的指导。范围涵盖了团队角色的定义、所需技能的分析、团队协作的策略,以及实际项目中的应用和相关资源的推荐。本文将首先介绍AI开发团队的核心概念与联系,包括团队角色、技能和协作之间的关系。接着阐述核心算法原理和具体操作步骤,结合数学模型和公式进行详细讲解。

2502_91592937的博客 995

Self Numbers

Problem Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n

Cia_zibo的博客 625

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

G - Self Numbers(2.2.1)

Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d

Shawn Hou 723

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Self-Numbers解题报告

题目描述: 题目描述 在1949年印度数学家D. R. Daprekar发现了一类称作Self-Numbers的数。对于每一个正整数n,我们定义d(n)为n加上它每一位数字的和。例如,d(75)=75+7+5=87。给定任意正整数n作为一个起点,都能构造出一个无限递增的序列:n, d(n), d(d(n)), d(d(d(n))), . . . 例如,如果你从33开始,下一个数是33+

HaoGe17的博客 2105

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

hdu 1128

暴力求解 直播入口——欢迎围观ACM/ICPC北京现场赛~ Self Numbers Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3703    Accepted Submission(

577

0377---Self Numbers

Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d s

江湖小小生 593

CCF NOI1052 Self-Numbers

问题链接:CCF NOI1052 Self-Numbers。 时间限制: 1000 ms  空间限制: 262144 KB 题目描述    在1949年印度数学家D. R. Daprekar发现了一类称作Self-Numbers的数。对于每一个正整数n,我们定义d(n)为n加上它每一位数字的和。例如,d(75)=75+7+5=87。给定任意正整数n作为一个起点,都能构

海岛Blog 2321

输入第一行是一个整数T,表示有T组测试实例; 每组输入包括两行: 第一行一个数n表示接下来会有n个整数; 第二行空格隔开的n个数。 输出 对于每组输入,在一行输出n个数的和

#include<stdio.h> int main() { /*求n个整数的和。 输入 输入第一行是一个整数T,表示有T组测试实例; 每组输入包括两行: 第一行一个数n表示接下来会有n个整数; 第二行空格隔开的n个数。 输出 对于每组输入,在一行输出n个数的和(保证和不会超出int类型的范围)! 样例输入 Copy 2 3 1 2 3 4 -1 0 -19 22 样例输出 Copy ...

qq_43728862的博客 8万+

HDU2076 夹角有多大【水题】

夹角有多大(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 27097 Accepted Submission(s): 10627 Problem Description 时间过的好快,一个学期就这么的过去了...

海岛Blog 703
上一篇: CSUFT 2018年 个人赛(1) B题(HihoCoder 1331) 及G题 (HDU - 2669)
下一篇: 判断字符是否为字母,数字 HDU - 2024
OneLine_
博客等级 码龄9年 48粉丝 72原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值