CF 1081A

本文探讨了一道数学竞赛题目的解决方案,题目要求从给定数开始,每次减去一个与该数互质的数,求能达到的最小值。通过分析发现,除了2以外,任意正整数减去其相邻的较小数都能得到最小互质差为1的结果。

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

https://cn.vjudge.net/problem/2102982/origin

题目大意
从 ? 开始每次减去一个不是 ?的约数的数 最小能得到多少

解题思路
不是n的约数的数 就是与n互质
而相邻的两个自然数是互质数(2是例外

代码如下

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	if(n==2)
	  cout<<"2"<<endl;
	else
	  cout<<"1"<<endl;
	return 0;
}
{"app_name":"Installer","timestamp":"2025-03-19 17:04:54.00 +0800","app_version":"6.2.0","slice_uuid":"4ae2bdd4-239d-3997-91cf-fcd007947673","build_version":"1131","platform":0,"bundleID":"com.apple.installer","share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 13.2.1 (22D68)","roots_installed":0,"name":"Installer","incident_id":"2A0F9FA4-294B-48D3-A886-4C1A40776F62"} { "uptime" : 23000, "procRole" : "Foreground", "version" : 2, "userID" : 501, "deployVersion" : 210, "modelCode" : "MacBookPro17,1", "coalitionID" : 4237, "osVersion" : { "train" : "macOS 13.2.1", "build" : "22D68", "releaseType" : "User" }, "captureTime" : "2025-03-19 17:04:54.0449 +0800", "incident" : "2A0F9FA4-294B-48D3-A886-4C1A40776F62", "pid" : 3791, "translated" : true, "cpuType" : "X86-64", "roots_installed" : 0, "bug_type" : "309", "procLaunch" : "2025-03-19 17:04:25.0762 +0800", "procStartAbsTime" : 573181073073, "procExitAbsTime" : 573875955811, "procName" : "Installer", "procPath" : "\/System\/Library\/CoreServices\/Installer.app\/Contents\/MacOS\/Installer", "bundleInfo" : {"CFBundleShortVersionString":"6.2.0","CFBundleVersion":"1131","CFBundleIdentifier":"com.apple.installer"}, "buildInfo" : {"ProjectName":"Installer","SourceVersion":"1131000000000000","BuildVersion":"1008"}, "storeInfo" : {"deviceIdentifierForVendor":"0DEC46C8-DECB-50A1-9B30-ACAAA6C29F2E"}, "parentProc" : "launchd", "parentPid" : 1, "coalitionName" : "com.apple.installer", "crashReporterKey" : "BEB86B0A-A37E-7DA0-4384-8CDA4FCBA770", "wakeTime" : 1081, "sleepWakeUUID" : "21FC250E-1FCF-4589-8844-330396D4C5F5", "sip" : "disabled", "vmRegionInfo" : "0x20 is not in any region. Bytes before following region: 140722817843168\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n mapped file 7ffc9591c000-7ffca03e8000 [170.8M]
最新发布
03-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值