Codeforces Round #511 (Div. 2).A. Little C Loves 3 I(水题)

本文介绍了一种算法,用于将任意正整数n拆分为三个正整数a、b、c,使得a+b+c=n且a、b、c均不为3的倍数。通过巧妙的数学逻辑,我们提供了三种不同的情况分析,确保了对于所有可能的输入都有解。算法简单高效,适用于竞赛编程和数论研究。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A. Little C Loves 3 I

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Little C loves number «3» very much. He loves all things about it.

Now he has a positive integer nn. He wants to split nn into 33 positive integers a,b,ca,b,c, such that a+b+c=na+b+c=n and none of the 33 integers is a multiple of 33. Help him to find a solution.

Input

A single line containing one integer nn (3≤n≤1093≤n≤109) — the integer Little C has.

Output

Print 33 positive integers a,b,ca,b,c in a single line, such that a+b+c=na+b+c=n and none of them is a multiple of 33.

It can be proved that there is at least one solution. If there are multiple solutions, print any of them.

Examples

input

Copy

3

output

Copy

1 1 1

input

Copy

233

output

Copy

77 77 79
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M(a) memset(a,0,sizeof(a))
#define maxn 200010

int main()
{
    ll n;
    while(cin>>n)
    {
        if(n%3==0) cout<<1<<' '<<1<<' '<<n-2<<endl;
        else if(n%3==1) cout<<2<<' '<<1<<' '<<n-3<<endl;
        else cout<<2<<' '<<2<<' '<<n-4<<endl;
    }
    return 0;
}

 

### 关于 Codeforces Round 839 Div 3目与解答 #### 目概述 Codeforces Round 839 Div 3 是一场面向不同编程平参赛者的竞赛活动。这类比赛通常包含多个难度层次分明的问,旨在测试选手的基础算法知识以及解决问的能力。 对于特定的比赛问及其解决方案,虽然没有直接提及 Codeforces Round 839 Div 3 的具体细节[^1],但是可以根据以往类似的赛事结构来推测该轮次可能涉及的内容类型: - **输入处理**:给定一组参数作为输入条件,这些参数定义了待解决的任务范围。 - **逻辑实现**:基于输入构建满足一定约束条件的结果集。 - **输出格式化**:按照指定的方式呈现最终答案。 考虑到提供的参考资料中提到的其他几场赛事的信息[^2][^3],可以推断出 Codeforces 圆桌会议的一般模式是围绕着组合数学、图论、动态规划等领域展开挑战性的编程任务。 #### 示例解析 以一个假设的例子说明如何应对此类竞赛中的一个问。假设有如下描述的一个简单排列生成问: > 对于每一个测试案例,输出一个符合条件的排列——即一系列数字组成的集合。如果有多种可行方案,则任选其一给出即可。 针对上述要求的一种潜在解法可能是通过随机打乱顺序的方式来获得不同的合法排列形式之一。下面是一个 Python 实现示例: ```python import random def generate_permutation(n, m, k): # 创建初始序列 sequence = list(range(1, n + 1)) # 执行洗牌操作得到新的排列 random.shuffle(sequence) return " ".join(map(str, sequence[:k])) # 测试函数调用 print(generate_permutation(5, 2, 5)) # 输出类似于 "4 1 5 2 3" ``` 此代码片段展示了怎样创建并返回一个长度为 `k` 的随机整数列表,其中元素取自 `[1..n]` 这个区间内,并且保证所有成员都是唯一的。需要注意的是,在实际比赛中应当仔细阅读官方文档所提供的精确规格说明,因为这里仅提供了一个简化版的方法用于解释概念。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值