打卡信奥刷题(344)用Scratch图形化工具信奥P4759[普及组/提高] [CERC2014] Sums

[CERC2014] Sums

题面翻译

题目大意

一共有 T T T 组数据,每组数据给定一个数 N N N,请将 N N N 分解为几个连续正整数的和,如果有多种情况,请输出最小数最大的情况。

输入格式:

第一行,一个整数 T T T,表示数据组数。

2 2 2 行至第 T + 1 T+1 T+1 行,每行一个整数 N N N,表示要拆分的数字。

输出格式

T T T 行,每行一个式子,表示拆分结果。

如果无解,请输出 IMPOSSIBLE

题目描述

Given an integer N N N, express it as the sum of at least two consecutive positive integers. For example:

  • 10 = 1 + 2 + 3 + 4 10 = 1 + 2 + 3 + 4 10=1+2+3+4
  • 24 = 7 + 8 + 9 24 = 7 + 8 + 9 24=7+8+9

If there are multiple solutions, output the one with the smallest possible number of summands.

输入格式

The first line of input contains the number of test cases T T T. The descriptions of the test cases follow:

Each test case consists of one line containing an integer N ( 1 ≤ N ≤ 1 0 9 ) N(1 \le N \le 10^9) N(1N109).

输出格式

For each test case, output a single line containing the equation in the format:
N = a + (a+1) + ... + b as in the example. If there is no solution, output a single word IMPOSSIBLE instead.

样例 #1

样例输入 #1

3
8
10
24

样例输出 #1

IMPOSSIBLE
10 = 1 + 2 + 3 + 4
24 = 7 + 8 + 9

Scratch实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kI2qGpC2-1721128110846)(https://i-blog.csdnimg.cn/direct/5166256f180144e28c03c0bfede41930.png)]

后续

接下来我会不断用scratch来实现信奥比赛中的算法题、Scratch考级编程题实现、白名单赛事考题实现,感兴趣的请关注,我后续将继续分享相关内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值