[牛客暑期多校第五场][思维]A-digits 2

https://ac.nowcoder.com/acm/contest/885/A

这个题。。。很烦。。。别的队都是随手秒的题。。。我们想了3个小时 最后还是我想了一个很奇怪的做法碰对了。。。
题意:给一个n 最大是100
输出一个数字满足一下3点要求
1.每位的数字之和可以被n整除
2.这个数能被n整除
3.数字的总位数不超过1e4

解题思路:一开始队友说打表做 一个个数字不断地试 可以发现到90左右的时候基本是5分钟才出答案 100的时候 基本是要几个小时才能出结果 如果不满足条件 输出impossible 我当时就卡在这里了 我去想的是找一个n的倍数 其实真正的思路很简单 只需要输出n个n 最大也才100*100 刚刚好是1e4 。。。

#include<algorithm>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<ctime>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<cstring>
using namespace std;
const int maxn = 1e5 + 5;
typedef long long ll;
int arr[maxn];
int arr1[maxn];
int arr2[maxn];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t,n;
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 0; i < n; i++) {
			cout << n;
		}
		cout << endl;
	}
	return 0;
}
//1 1 2 3 1+1+1+1+1+2+2+2+3+3 
//1 2 1 3 1+1+1+1+2+2+2+2+3+3
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇