社区讨论

红题都全屏TLE过不了了怎么办啊……

P1980[NOIP 2013 普及组] 计数问题参与者 7已保存回复 13

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
13 条
当前快照
1 份
快照标识符
@lo3e8n0p
此快照首次捕获于
2023/10/24 05:12
2 年前
此快照最后确认于
2023/10/24 05:12
2 年前
查看原帖
CPP
//#include<bits/stdc++.h>
///*
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<fstream>
#include<deque>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<set>
//*/
using namespace std;
long long cnt,x;
int zb666(int y){
	while(y){
		if(y%10==x) cnt++;
		y/=10;
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(0),cout.tie(0);
	int n;
	cin>>n>>x;
	for(int i=1;i<=n;i++){
		zb666(i);
	}
	cout<<cnt<<'\n';
	return 0;
}

TLE X﹏X

回复

13 条回复,欢迎继续交流。

正在加载回复...