跳到正文

个人记录

14号第二题

fyw20121122约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月11日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1
C++
#include<bits/stdc++.h>
using namespace std;
int main(){

	int t;
	cin>>t;
	while(t--){
		int n,d,k,x,ans=0;
		cin>>n>>d>>k>>x;
		for(int i=n;i<n+d;i++){
			int s=i;
			while(s){
				if(s%k==x){
					ans++;
				}
				s/=k;
			}

		}
		cout<<ans<<endl;
	}
	/*
	这出的什么78题
	小可爱出题者
	SB SB SB SB SB SB SB SB SB SB SB SB S
	.####...#####..########......#......#
	#.......#...#......#........##.....##
	#.......#...#......#.......#.#....#.#
	.###....#####......#......#..#...#..#
	....#...#....#.....#.....#...#..#...#
	....#...#... #.....#....#....#.#....#
	####....#####......#...#.....#......#
	SB SB SB SB SB SB SB SB SB SB SB SB S
	*/
	return 0;
}
原文