SGU118

大连海事大学课设题目/基于LM331的频率电压转换器 部分基于LM331的频压转换的实物连接问题 阅读详情

题目大意:

定义f(n)等于n的各位数字相加

如果一个数是一位数,那么它的数根就是f(n),否则它的数根是f(n)的数根

给定一个数列A1,A2,...,An

求A1*A2*…*AN + A1*A2*…*AN-1 + … + A1*A2 + A1 的数根


这种题其实是观察题来着

记得今年的省选还是省训有道题也给出了一样的定义,当时是打表看出来的

其实一个数的数根就是这个数mod 9的值(0的话看做9)

然后就水过


//Lib
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<ctime>

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
using namespace std;
//Macro
#define rep(i,a,b) for(int i=a,tt=b;i<=tt;++i)
#define rrep(i,a,b) for(int i=a,tt=b;i>=tt;--i)
#define erep(i,e,x) for(int i=x;i;i=e[i].next)
#define irep(i,x) for(__typedef(x.begin()) i=x.begin();i!=x.end();i++)
#define read() (strtol(ipos,&ipos,10))
#define sqr(x) ((x)*(x))
#define pb push_back
#define PS system("pause");
typedef long long ll;
typedef pair<int,int> pii;
const int oo=~0U>>1;
const double inf=1e20;
const double eps=1e-6;
string name="",in=".in",out=".out";
//Var
int T;
void Work()
{
	int sum=0,now=1,x,n;
	scanf("%d",&n);
	rep(i,1,n)
	{
		scanf("%d",&x);
		x%=9;now*=x;now%=9;sum+=now;sum%=9;
	}
	if(sum==0)sum=9;
	cout<<sum<<endl;
}
int main()
{
//	freopen((name+in).c_str(),"r",stdin);
//	freopen((name+out).c_str(),"w",stdout);
//	Init();
	for(scanf("%d",&T);T;T--)
		Work();
	return 0;
}


Qt界面编程(三)—— 父子关系、对象树、信号和槽(自定义信号和槽、Qt5与Qt4的写法) Qt框架默认提供的标准信号和槽不足以完成我们日常应用开发的需求,比如说点击某个按钮让另一个按钮的文字改变,这时候标准信号和槽就没有提供这样的函数。但是Qt信号和槽机制提供了允许我们自己设计自己的信号和槽。声明在类的signals域下没有返回值,void类型的函数只有函数声明,没有定义可以有参数,可以重载通过emit关键字来触发信号,形式:emit object->sig(参数); 阅读详情

相关推荐

【实战指南】RF-DETR多场景部署:从工业质检到自动驾驶的SOTA模型应用

本文深入解析了SOTA目标检测模型RF-DETR在工业质检与自动驾驶等多场景下的实战部署指南。该模型基于Transformer架构,在COCO数据集上实现了实时检测与高精度的突破,并凭借其强大的泛化能力,在RF100-VL等复杂数据集上表现出色。文章提供了从快速Demo、工业缺陷检测微调、车载自适应部署到多硬件平台性能优化的完整解决方案,帮助开发者高效应用这一先进模型。

weixin_29070861的博客 474

SGU 118 Digital Root(数论)

Description 给出n个数a[i],求a[1]a[2]..a[n]+a[1]*a[2]..*a[n-1]+…+a[1]*a[2]+a[1]的数字根,n的数字根就是n的每位数字之和的数字根,直到数值根为个位数为止,例如789的数字根就是24的数字根,也就是6 Input 第一行一整数T表示用例组数,每组用例首先为一整数n,之后为n个整数a[i] (1<=T<=5,1<=n<=1000

ZSQ 693

直流并联电压源的下垂控制与模拟光伏板特性的方法与仿真

并联直流电源下垂控制方法,下垂特性可以让并联直流电源输出功率/电流自动均衡,直流电源输出特性模拟光伏板的输出特性,具有自动限制输出最大功率的功能

1197

SGU118 数学题 Math

问题:令f(n)为n各个位数字之和。n的Digital Root是f(f(...f(n))),是一位数字。现在给你A1,A2...An,n个数,求A1*A2*…*AN + A1*A2*…*AN-1 + … + A1*A2 + A1的Digitial Root。 Problem: Let f(n) be a sum of digits for positive integer n. If f(n)

梦想天生 1373

【ESP32-IDF笔记】20-配置以太网网络(W5500)

基于ESP32IDF和官方的ethernet驱动,配置W5500以太网驱动芯片,实现ESP32的有线网络

别看了,就这些信息 3471

PTA 编程题(C语言)-- 然后是几点

PTA 编程题(C语言)-- 然后是几点

LCCprogrammer 5074

sgu118

SGU118 Digital root 题目大意: 设 f(n) 表示十进制正整数 n 的各位数字之和。如果 f(n) 是一个1位数那么他就是 n 的数根。否则的话 f(n) 的数根就是 n 的数根。举例说明:987的数根是 6(9+8+7=24 2+4=6)。你的任务是算出这样的数的数根: A1*A2*…*AN + A1*A2*…*AN-1 + … + A1*A2 + A1。  输入

Tgop_Knight的专栏 778

【零基础入门unity游戏开发——unity通用篇30】Resources资源加载(基于unity6开发介绍)

Resources资源加载(基于unity6开发介绍)

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 4116

SGU118——Digital Root

118. Digital Root time limit per test: 0.5 sec. memory limit per test: 4096 KB Let f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for

丙三醇 1511

Android Telephony主要模块及功能

Telephony的代码主要由五个模块组成 1.Telephony Frameworks 代码区域: frameworks/opt/telephony/ 其中主要的文件在如下目录 /frameworks/opt/telephony/src/java/com/android/internal/telephony/ 其中比较常见的有以下几类文件 1.BaseCommands、RIL构成R

泊客 7720

FPGA原型验证(八):SoC设计适配与实现策略

时钟门控在SoC设计中很常见,应该小心处理门控时钟,以成功地在FPGA上原型化SoC设计。现代FPGA综合工具在正确约束的情况下,可以自动处理大多数门控时钟。通过遵循本章中的指导方针,即使具有复杂时钟门控的SoC设计也可以得到处理,并成功地在FPGA上进行原型化。

叫好与叫座虽然不是对立面,但想在同一个作品中达到双重效果很难。 477

SGU118 Digital Root

令V=A1∗A2∗…∗AN + A1∗A2∗…∗AN−1 + … + A1∗A2 + A1 每次将V变为V的数位和,直至V小于10,输出这时V的值

╮(╯▽╰)╭ 656

UG\NX二次开发 判断对象是虚线还是实线

网友提问“怎么区分虚线实线”,这个可以通过函数判断。

王牌飞行员_里海的博客 357

【SGU】118. Digital Root

传送门:【SGU】118. Digital Root 题目分析:

poursoul 1109

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

SGU 118 Digital Root

#include<stdio.h>#include<string.h>void solve(){ int i, j, k, n, ans, cur; cur = 1, ans = 0; scanf("%d", &n); for(i = 0; i < n; i ++) { scanf("%d", &k...

weixin_30706507的博客 83

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

SGU 水题集3 SGU116 SGU117 SGU118 SGU119

我又推荐了四道大水题 SGU116 【dp+背包】 #include #include #define MAX 120005 int prime[1200]={1184,3,5,11,17,31,41,59,67,83,109,127,157,179,191,211,241,277,283,331,353,367,401,431,461,509,547,563,587,599,617,70

Prime21 1377

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

SGU 118

本来想用大数模版暴力搞的。。。汗。。。 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #ifdef _WIN32 #define i64 __int64 #defin

量子流逝 591

sgu 118

题意   定义f(n)为n各位数字之和,如果n是各位数,则n个数根是f(n),否则为f(n)的数根   现在给出n个Ai,求出A1*A2*…*AN+ A1*A2*…*AN-1+ … + A1*A2+ A1这个式子的数根   多组数据 分析   首先,要知道这样一个结论:     任何一个整数模9同余于它的各数位上数字之和   具体证明过程如下:   设自然数N=a[n...

weixin_30631587的博客 156

SGU[118] Digital Root

Description 描述 Let f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n and otherwise digital root of n is equal to digital root of f(n). ...

asd5215208的博客 160

sgu 118 Digital Root

118. Digital Root time limit per test: 0.5 sec. memory limit per test: 4096 KB Let f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n

utoppia is another word . 400

sgu 118 Digital Root 数学规律

118. Digital Roottime limit per test: 0.25 sec. memory limit per test: 4096 KBLet f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n and otherw...

superkunn的博客 332

sgu 118 Digital root

Thedigital root(alsorepeated digital sum) of anon-negative integeris the (single digit) value obtained by an iterative process ofsumming digits 规律题 题意   定义f(n)为n各位数字之和,如果n是各位数,则n个数根是f(n),否则为f...

weixin_30732825的博客 136

SGU - 118 Digital Root

Let f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n and otherwise digital root of n is equal to digital root of f(n). For example, digital r...

ling_wang的博客 327
上一篇: SGU117
下一篇: 关于FFT快速傅里叶变换
OrpineX
博客等级 码龄17年 16粉丝 68原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值