洛谷 P1662 数7

题目链接:数7

题目描述

1337个人排成一个圈,从1号人开始报数,初始方向是1,2,3…。如果某个人报的数是7的倍数或数字中含有7,那么报数的方向就反一下。问报数字 X X X的是哪个人?

比如初始20个数字的情况是:

1:1 2:2 3:3 4:4 5:5 6:6 7:7 6:8 5:9 4:10 3:11 2:12 1:13 1337:14 1:15 2:16 3:17 2:18 1:19 1337:20

输入格式

一行一个数 X X X

输出格式

一行一个数表示最终报数字 X X X的是哪个人。

输入输出样例

输入

1000

输出

1311

【数据规模】

对于30%的数据,满足 X ≤ 1 0 6 X≤10^6 X106;
对于90%的数据,满足 X ≤ 1 0 8 X≤10^8 X108;
对于100%的数据,满足 X ≤ 1 0 9 X≤10^9 X109

题目思路

1.打表大法:暴力模拟
2.隔断打表:
我们把整个大的区间分为若干个,用暴力算一下每个区间的第一个数,然后在这第一个数的基础上用暴力方法计算。

代码

暴力模拟

/*************************************************
Note:
*************************************************/
#include <queue>
#include <stack>
#include <set>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#define ll long long
#define ull unsigned long long
using namespace std;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
#define REG register
#define IN inline
#define For(x, y, z) for (REG int(x) = (y); (x) <= (z); ++(x))
#define FOR(x, y, z) for (REG int(x) = (y); (x) < (z); ++(x))
const int kmax_num = 1e3 + 10, kmax_int = INT_MAX, kmod = 10007;
inline int read()
{
    int s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
        s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}
int f[kmax_num] = {
    0, 469, 139, 1086, 768, 860, 1200, 837, 837, 507, 117,
    1136, 1228, 231, 1205, 337, 7, 954, 954, 862, 522,
    885, 416, 746, 1136, 117, 25, 1022, 1022, 154, 1161,
    771, 453, 545, 885, 522, 991, 661, 661, 979, 887,
    547, 910, 441, 771, 1161, 142, 50, 50, 1024, 156,
    1163, 773, 455, 547, 887, 524, 993, 993, 46, 364,
    272, 1269, 295, 1163, 156, 546, 864, 864, 1204, 841,
    841, 841, 841, 841, 841, 841, 841, 841, 841, 841,
    523, 615, 955, 592, 1061, 731, 341, 341, 249, 1246,
    272, 1140, 133, 523, 841, 749, 409, 409, 878, 548,
    158, 1177, 1269, 272, 1246, 378, 48, 48, 366, 274,
    1271, 297, 1165, 158, 548, 866, 774, 774, 411, 880,
    550, 160, 1179, 1271, 274, 1248, 380, 380, 770, 1088,
    996, 656, 1019, 550, 880, 1270, 251, 251, 591, 228,
    697, 367, 1314, 996, 1088, 91, 1065, 1065, 735, 345,
    27, 119, 459, 96, 565, 235, 1182, 1182, 1090, 750,
    1113, 644, 974, 27, 345, 253, 1250, 1250, 382, 52,
    52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
    1049, 75, 943, 1273, 326, 644, 552, 552, 189, 658,
    328, 1275, 957, 1049, 52, 1026, 158, 158, 548, 866,
    774, 434, 797, 328, 658, 1048, 29, 29, 369, 6,
    475, 145, 1092, 774, 866, 1206, 843, 843, 513, 123,
    1142, 1234, 237, 1211, 343, 13, 960, 960, 868, 528,
    891, 422, 752, 1142, 123, 31, 1028, 1028, 160, 1167,
    777, 459, 551, 891, 528, 997, 667, 667, 985, 893,
    553, 916, 447, 777, 1167, 148, 56, 56, 1030, 162,
    1169, 779, 461, 553, 893, 530, 999, 999, 52, 370,
    370, 370, 370, 370, 370, 370, 370, 370, 370, 370,
    839, 509, 119, 1138, 1230, 233, 1207, 1207, 877, 487,
    169, 261, 601, 238, 707, 377, 1324, 1324, 1232, 892,
    1255, 786, 1116, 169, 487, 395, 55, 55, 524, 194,
    1141, 823, 915, 1255, 892, 24, 1031, 1031, 12, 1257,
    917, 1280, 811, 1141, 194, 512, 420, 420, 57, 526,
    196, 1143, 825, 917, 1257, 894, 26, 26, 416, 734,
    642, 302, 665, 196, 526, 916, 1234, 1234, 237, 1211,
    343, 13, 960, 642, 734, 1074, 711, 711, 381, 1328,
    1010, 1102, 105, 1079, 211, 1218, 828, 828, 736, 396,
    396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
    786, 1104, 1012, 672, 1035, 566, 896, 896, 578, 670,
    1010, 647, 1116, 786, 396, 78, 170, 170, 533, 64,
    394, 784, 1102, 1010, 670, 1033, 564, 564, 174, 1193,
    1285, 288, 1262, 394, 64, 1011, 693, 693, 353, 716,
    247, 577, 967, 1285, 1193, 853, 1216, 1216, 209, 599,
    917, 825, 485, 848, 379, 709, 1099, 1099, 1191, 194,
    1168, 300, 1307, 917, 599, 691, 1031, 1031, 562, 892,
    1282, 263, 171, 1168, 194, 1062, 55, 55, 1074, 1166,
    169, 1143, 275, 1282, 892, 574, 666, 666, 1029, 560,
    560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
    652, 992, 629, 1098, 768, 378, 60, 60, 1057, 83,
    951, 1281, 334, 652, 560, 220, 583, 583, 913, 1303,
    284, 192, 1189, 215, 1083, 76, 466, 466, 558, 898,
    535, 1004, 674, 284, 1303, 58, 398, 398, 1266, 259,
    649, 967, 875, 535, 898, 429, 759, 759, 441, 533,
    873, 510, 979, 649, 259, 1278, 33, 33, 396, 1264,
    257, 647, 965, 873, 533, 896, 427, 427, 37, 1056,
    1148, 151, 1125, 257, 1264, 874, 556, 556, 216, 579,
    110, 440, 830, 1148, 1056, 716, 1079, 1079, 72, 462,
    462, 462, 462, 462, 462, 462, 462, 462, 462, 462,
    99, 568, 238, 1185, 867, 959, 1299, 1299, 830, 1160,
    213, 531, 439, 99, 462, 1330, 323, 323, 5, 97,
    437, 74, 543, 213, 1160, 842, 934, 934, 1297, 828,
    1158, 211, 529, 437, 97, 460, 1328, 1328, 938, 620,
    712, 1052, 689, 1158, 828, 438, 120, 120, 1117, 143,
    1011, 4, 394, 712, 620, 280, 643, 643, 973, 26,
    344, 252, 1249, 275, 1143, 136, 526, 526, 618, 958,
    595, 1064, 734, 344, 26, 118, 458, 458, 1326, 319,
    709, 1027, 935, 595, 958, 489, 819, 819, 501, 593,
    593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
    263, 1210, 892, 984, 1324, 961, 93, 93, 483, 801,
    709, 369, 732, 263, 593, 983, 1301, 1301, 304, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278, 1278,
    331, 649, 557, 217, 580, 111, 441, 441, 123, 215,
    555, 192, 661, 331, 1278, 960, 1052, 1052, 78, 946,
    1276, 329, 647, 555, 215, 578, 109, 109, 1056, 738,
    830, 1170, 807, 1276, 946, 556, 238, 238, 1235, 261,
    1129, 122, 512, 830, 738, 398, 761, 761, 1091, 144,
    462, 370, 30, 393, 1261, 254, 644, 644, 736, 1076,
    713, 1182, 852, 462, 144, 236, 576, 576, 107, 437,
    437, 437, 437, 437, 437, 437, 437, 437, 437, 437,
    777, 414, 883, 553, 163, 1182, 1274, 1274, 300, 1168,
    161, 551, 869, 777, 437, 800, 331, 331, 1278, 960,
    1052, 55, 1029, 161, 1168, 778, 460, 460, 120, 483,
    14, 344, 734, 1052, 960, 620, 983, 983, 1313, 366,
    684, 592, 252, 615, 146, 476, 866, 866, 958, 1298,
    935, 67, 1074, 684, 366, 458, 798, 798, 329, 659,
    1049, 30, 1275, 935, 1298, 829, 1159, 1159, 841, 933,
    1273, 910, 42, 1049, 659, 341, 433, 433, 796, 327,
    657, 1047, 28, 1273, 933, 1296, 827, 827, 437, 119,
    119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
    987, 1317, 370, 688, 596, 256, 619, 619, 949, 2,
    320, 228, 1225, 251, 1119, 112, 502, 502, 594, 934};
int d[kmax_num] = {
    1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1,
    0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0,
    1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1,
    0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0,
    1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1,
    0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1,
    1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1,
    0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1,
    0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1,
    0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0,
    1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1,
    0, 1, 0, 1, 0, 1, 1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0, 1,
    0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0,
    1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1};

inline bool Judge(REG int num)
{
    if (!(num % 7))
        return true;
    while (num)
    {
        if (num % 10 == 7)
            return true;
        else
            num /= 10;
    }
    return false;
}

int main()
{
    REG int n, now;
    REG bool dir;
    scanf(" %d", &n);

    now = f[n / 1000000];
    dir = d[n / 1000000];
    For(i, n / 1000000 * 1000000 + 1, n)
    {
        if (!dir)
        {
            --now;
            if (!now)
                now = 1337;
            if (Judge(i))
                dir = 1;
        }
        else if (dir)
        {
            ++now;
            if (now == 1338)
                now = 1;
            if (Judge(i))
                dir = 0;
        }
    }
    printf("%d\n", now);
    return 0;
}

隔断打表

/*************************************************
Note:
*************************************************/
#include <queue>
#include <stack>
#include <set>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#define ll long long
#define ull unsigned long long
using namespace std;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
inline int read()
{
    int s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
        s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}
int n, i, j, k, t, pd, m;
int ha(int x, int y, int z, int a)
{
    t = z;
    for (i = x; i <= y; i++)
    {
        t += a;
        if (i % 7 == 0)
            a = -a;
        else
        {
            k = i;
            while (k)
            {
                if (k % 10 == 7)
                {
                    a = -a;
                    break;
                }
                k /= 10;
            }
        }
        if (t == 0)
            t = 1337;
        if (t == 1338)
            t = 1;
    }
    printf("%d", t);
}
int main()
{
    // freopen("a.in","r",stdin);
    // freopen("seven.out","w",stdout);
    scanf("%d", &n);
    if (n < 5e7)
    {
        ha(1, n, 0, 1);
    }
    else if (n < 1e8)
    {
        ha(5e7, n, 157, -1);
    }
    else if (n < 1e8 + 5e7)
    {
        ha(1e8, n, 547, 1);
    }
    else if (n < 2e8)
    {
        ha(1e8 + 5e7, n, 346, -1);
    }
    else if (n < 2e8 + 5e7)
    {
        ha(2e8, n, 867, -1);
    }
    else if (n < 3e8)
    {
        ha(2e8 + 5e7, n, 892, 1);
    }
    else if (n < 3e8 + 5e7)
    {
        ha(3e8, n, 893, -1);
    }
    else if (n < 4e8)
    {
        ha(3e8 + 5e7, n, 1212, -1);
    }
    else if (n < 4e8 + 5e7)
    {
        ha(4e8, n, 63, 1);
    }
    else if (n < 5e8)
    {
        ha(4e8 + 5e7, n, 893, -1);
    }
    else if (n < 5e8 + 5e7)
    {
        ha(5e8, n, 1302, -1);
    }
    else if (n < 6e8)
    {
        ha(5e8 + 5e7, n, 1055, 1);
    }
    else if (n < 6e8 + 5e7)
    {
        ha(6e8, n, 98, -1);
    }
    else if (n < 7e8)
    {
        ha(6e8 + 5e7, n, 957, 1);
    }
    else if (n < 7e8 + 5e7)
    {
        ha(7e8, n, 1279, -1);
    }
    else if (n < 8e8)
    {
        ha(7e8 + 5e7, n, 1279, -1);
    }
    else if (n < 8e8 + 5e7)
    {
        ha(8e8, n, 1279, -1);
    }
    else if (n < 9e8)
    {
        ha(8e8 + 5e7, n, 143, 1);
    }
    else if (n < 9e8 + 5e7)
    {
        ha(9e8, n, 959, 1);
    }
    else if (n <= 1e9)
    {
        ha(9e8 + 5e7, n, 934, -1);
    }
    return 0;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 下面是一个简单的C语言实现,用于判断一个是否为回文: ```c #include <stdio.h> #include <string.h> int main() { char n[10]; scanf("%s", n); int len = strlen(n); int flag = 1; for (int i = 0; i < len / 2; i++) { if (n[i] != n[len - i - 1]) { flag = 0; break; } } if (flag) printf("yes"); else printf("no"); return 0; } ``` 其中,使用字符组 `n` 读入输入的字,`len` 记录字的长度,`flag` 为判断标志,初始化为1。然后,通过循环判断字是否为回文,若不是,则将 `flag` 设为0,跳出循环。最后,根据 `flag` 输出判断结果。 需要注意的是,输入的字可能存在前导零,因此应当使用字符组进行输入和处理,避免出现错误。 ### 回答2: 洛谷p1015是一道题目要求编写C语言程序来判断一个整是否为回文。 回文是指正读和反读都一样的。例如121、3223都是回文,而123、12321不是回文。回文的判断可以通过将字转为字符串的方法,将该字符串与其反转后的字符串进行比较来实现。 首先,我们需要定义一个函来判断一个整是否是回文。函的输入是一个整,输出为1表示是回文,输出为0表示不是回文。 函的实现步骤如下: 1. 将整转为字符串。 2. 定义一个变量left表示字符串的起始位置,变量right表示字符串的结束位置。 3. 通过循环比较左右两边的字符,如果不相等,则可以判断该整不是回文,返回0。 4. 如果循环结束后没有返回0,则表示该整是回文,返回1。 在主函中,我们需要读入一个整n,并调用判断回文的函来判断n是否是回文。然后根据函的返回值输出判断结果。 以上就是洛谷p1015回文的C语言实现。其中,核心思想是将整转为字符串,并通过比较左右两边的字符来判断是否是回文。 ### 回答3: 洛谷p1015是一个关于回文的问题,需要用C语言编写。 回文是指正序和逆序都相同的字,例如121、131、1221等。 要解决这个问题,首先我们需要将输入的字进行逆序排列,然后与原字进行比较,如果相等,则说明该字是回文。 具体的解题思路如下: 1. 首先,我们需要读取输入的字n,n是一个整。 2. 我们需要编写一个函reverse,用于将字进行逆序排列。可以通过取余和除以10的方式逐位取得字。 3. 在主函中,调用reverse函将输入的字n进行逆序排列,得到逆序后的字rev。 4. 进行比较,如果n和rev相等,则说明该字是回文。 5. 如果n和rev不相等,则说明该字不是回文。 6. 输出结果,如果是回文,则输出"YES",否则输出"NO"。 下面是一个简单的实现示例: ```c #include<stdio.h> int reverse(int num){ int rev=0; while(num>0){ rev=rev*10+num%10; num/=10; } return rev; } int main(){ int n; scanf("%d",&n); int rev=reverse(n); if(n==rev){ printf("YES"); }else{ printf("NO"); } return 0; } ``` 这样,我们就使用C语言解决了洛谷p1015回文问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

꧁Q༒ོγ꧂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值