首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
zxjrheaven
2025年3月23日 23:17
求30的倍数 题解:暴力之prev_permutation
P1736
回复 0
|
赞 6
|
浏览 377
//对这道题,prev_permutation比next_permutation快很多 #include<bits/stdc++.h> using namespace std; int num[100]; bool cmp(int a,int b) { return a>b; } int main() { int n; cin>>n; int i=0; &...
阿灿
2025年3月19日 13:46
求30的倍数 题解:写多了,家人们一定要赋初始值
P1736
回复 0
|
赞 4
|
浏览 420
#include<bits/stdc++.h> using namespace std; int main(){ string n; int i; cin>>n; bool flag = 0; int num=0; int uu =n.length(); int ans[200]; //判断出来不能被30整除的 for(i=0;i<uu;i++){ ans[i] = n[i] -'0'; num += n[i] - '0'; if(ans[i] == 0){ flag = 1; ...
西电机试专家
2025年3月16日 15:59
求30的倍数 题解:冷知识,能被3整除的数每位加起来的和也可以被3整除
P1736
回复 0
|
赞 12
|
浏览 514
#include <bits/stdc++.h> using namespace std; bool cmp(int a,int b){ return a>b; } int main(){ int n; cin>>n; int a[101],j=0; while(n>0){ &nbs...
Y969432769845
2025年3月11日 16:49
求30的倍数 题解:挑战最短代码ac
P1736
回复 0
|
赞 12
|
浏览 465
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; sort(s.begin(), s.end()); // 升序排列,为之后按顺序生成所有排列服务 long long max_num = -1; do { long long num = stoll(s); // 字符串转数字,stol...
aichitudou
2025年2月11日 21:21
求30的倍数 题解:
P1736
回复 0
|
赞 15
|
浏览 493
#include<bits/stdc++.h> using namespace std; bool cmp(int x,int y){ return x>y; } int a[1005]; string s=""; int main(){ cin>>s; for(int i=0;i<s.size();i++){ a[i]=s[i]-'0';//字符转数字 } int flag=0; int sum=0; for(int i=0;i<s.size();i++){//分别划分为同时被3和10整除 ...
RingoCrystal
2025年2月8日 10:14
求30的倍数 题解:数学优化
P1736
回复 1
|
赞 6
|
浏览 814
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; // 统计每个数字的出现次数 int count[10] = {0}; for (char c : s) { count[c - '0']++; } // 检查是否包含 0 if (count[0] == 0) { cout << -1 << endl...
huanghu
2024年3月24日 15:22
求30的倍数 题解:C++全排列函数
P1736
回复 0
|
赞 3
|
浏览 1.3k
#include <iostream> #include <vector> #include<string> #include<algorithm> using namespace std; int main(){ string str; cin>>str; int n = str.length(); vector<char> v(n); for(int i = 0; i<n; i++){ v[i] = str[i]; } vector<int&g...
Bzreach
2023年3月19日 17:05
直接调用全排列函数,这类题直接秒杀
P1736
回复 0
|
赞 15
|
浏览 4.9k
#include <bits/stdc++.h> using namespace std; int main(){ string s; int a[105]; cin>>s; int len=s.size(); sort(s.begin(),s.end()); int maxx=0,flag=0; do{ int sum=0; for(int i=0;i<len;i++){ sum=sum*10+s[i]-'0'; ...
happyday
2022年4月7日 15:28
全排列
P1736
回复 0
|
赞 3
|
浏览 5.3k
#include <bits/stdc++.h> using namespace std; bool check(string s){ int num = atoi(s.c_str()); if(num%30==0) return true; return false; } int main(){ string s; cin>>s; int maxx=0; do{ if(check(s)){ maxx = max(maxx,atoi...
Ashley1101
2022年2月23日 16:43
【回溯法】求30的倍数
P1736
回复 0
|
赞 2
|
浏览 5.0k
#include<algorithm> #include<vector> #include<string> #include<iostream> using namespace std; //回溯法 string function(string num, string &tmp, int &flag) { //填完所有数字 if (num.empty()) { &n...
1
2
题目
求30的倍数
题解数量
11
发布题解
在线答疑
热门题解
1
直接调用全排列函数,这类题直接秒杀
2
求30的倍数 题解:
3
求30的倍数 题解:挑战最短代码ac
4
求30的倍数 题解:冷知识,能被3整除的数每位加起来的和也可以被3整除
5
求30的倍数 题解:暴力之prev_permutation
6
求30的倍数 题解:数学优化
7
各个位置和为3的倍数同时至少有一个零则满足条件
8
求30的倍数 题解:写多了,家人们一定要赋初始值
9
求30的倍数 题解:C++全排列函数
10
全排列