A. Good Number

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Let's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).

Input

The first line contains integers n and k (1 ≤ n ≤ 1000 ≤ k ≤ 9). The i-th of the following n lines contains integer ai without leading zeroes (1 ≤ ai ≤ 109).

Output

Print a single integer — the number of k-good numbers in a.

Sample test(s)
input
10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
output
10
input
2 1
1
10
output
1

解题说明:此题的意思是指定一个k,判断一个字符串中是否只出现0-k-1这k个数字。做法是统计出现过的每个数字,然后加以判断即可。


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include <cstring>
using namespace std;

int main()
{
	int n, k,count=0;
	int arr[101], i, j;
	scanf("%d %d", &n, &k);
	for (i = 0; i<n; i++)
	{
		scanf("%d", &arr[i]);
		int hash[10] = { 0 };
		while (arr[i])
		{
			hash[arr[i] % 10] = 1;
			arr[i] /= 10;
		}
		for (j = 0; j <= k; j++)
		{
			if (!hash[j])
			{
				break;
			}
		}
		if (j == k + 1)
		{
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


找出sql错误SELECT * FROM ( SELECT a.id, a.CODE AS 'sourceBillCode', a.type AS 'originalOrderType', a.unit_of_origin, a.unit_of_origin_type, a.time AS 'orderOriginCreationTime', a.warehouse, a.receiving_storage_space, b.type_of_material, b.quality_control_number, b.good_products_number, b.defective_products_number, b.yield, b.quantity_of_returns, b.as_received_condition, b.quantity_of_order, b.quantity_not_received, b.quantity_of_goods_received, b.number_of_spare_parts, b.quantity_of_returns_actual, b.special_production_quantity, b.quantity_in_storage, b.receipt_quantity AS 'inqty', b.quantity_not_in_storage FROM wareh_source_order a LEFT JOIN statistics_receiving_order b ON a.id = b.order_id UNION ALL SELECT a.id, a.CODE AS 'sourceBillCode', a.type AS 'originalOrderType', a.unit_of_origin, a.source_of_delivery_note, a.time AS 'orderOriginCreationTime', a.warehouse, a.receiving_storage_space, b.type_of_material, b.quality_control_number, b.good_products_number, b.defective_products_number, b.yield, b.quantity_of_returns, b.as_received_condition, b.quantity_of_order, b.quantity_not_received, b.quantity_of_goods_received, b.number_of_spare_parts, b.quantity_of_returns_actual, b.special_production_quantity, b.quantity_in_storage, b.receipt_quantity AS 'inqty', b.quantity_not_in_storage FROM wareh_source_order a LEFT JOIN statistics_purchase_order b ON a.id = b.order_id ) tab WHERE originalOrderType IN ( 'PurchaseOrder', 'ReceiptRecord' ) AND warehouse = 'string' AND receiving_storage_space = 'string' AND date_format( orderOriginCreationTime, '%y%m%d' ) >= date_format( '2023-07-07 00:00:00.0', '%y%m%d' ) AND date_format( orderOriginCreationTime, '%y%m%d' ) <= date_format( '2023-07-07 00:00:00.0', '%y%m%d' ) AND ( EXISTS ( SELECT material_no FROM wareh_source_order_list c WHERE c.order_id = id AND ( c.material_name REGEXP 'string' OR c.material_full REGEXP 'string' OR c.material_lot REGEXP 'string' ) ) OR source_of_delivery_note REGEXP 'string' OR CONVERT ( source_bill_code USING utf8mb4 ) REGEXP 'string' )
最新发布
07-08
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值