Problem 3826 --Dislike of Threes

3826: Dislike of Threes

"
Time Limit $1$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

Polycarp doesn't like integers that are divisible by 3 or end with the digit 3 in their decimal representation. Integers that meet both conditions are disliked by Polycarp, too.

Polycarp starts to write out the positive (greater than 0) integers which he likes: 1,2,4,5,7,8,10,11,14,16,… Output the k-th element of this sequence (the elements are numbered from 1).

The first line contains one integer t (1≤t≤100) — the number of test cases. Then t test cases follow.

Each test case consists of one line containing one integer k (1≤k≤1000).

For each test case, output in a separate line one integer x — the k-th element of the sequence that was written out by Polycarp.
10
1
2
3
4
5
6
7
8
9
1000
1
2
4
5
7
8
10
11
14
1666

推荐代码 查看3826 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$2 $ms] thisislike 963958 2023-05-28 13:00:22
内存最少[$2384 $KB] thisislike 963958 2023-05-28 13:00:22
第一AC thisislike 963958 2023-05-28 13:00:22
第一挑战 thisislike 963958 2023-05-28 13:00:22

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛