弱鸡问一下,怎样输入呀,我只会c现在

P1957 口算练习题

aurus @ 2021-12-17 14:59:53

神犇们,这咋输入呀


by 君と僕のNOIP @ 2021-12-17 15:14:47

@aurus 从键盘输入


by hjl2011 @ 2021-12-17 15:36:58

@aurus

scanf("%c%d%d",...)

by aurus @ 2021-12-17 18:00:36

@_HJL 不是,我是搞不懂怎样解决一会儿两个变量一会儿三个变量


by 君と僕のNOIP @ 2021-12-17 18:05:57

@aurus if


by hjl2011 @ 2021-12-17 20:01:23

@aurus

建议用快读 + if


by Johnmustcode @ 2021-12-25 21:09:16

你看看我的,我也只会c,你用mark读入字符,判断是否在1和9里,如果在就用之前的,利用一个flag保存上次的mark

for(i=0;i<step;i++) { getchar(); getchar(); scanf("%c",&mark[i]); scanf("%d %d",&a[i],&b[i]); if(mark[i]>='1'&&mark[i]<='9') { x = a[i]; while(x!=0) { x/=10; cnt[i]++; } a[i] += ((mark[i]-'0')*pow(10,cnt[i])); mark[i] = flag; } cnt[i] = 2; flag = mark[i];


by Eleveslaine @ 2022-01-16 18:21:37

@Johnmustcode 希望更丰富的展现?使用Markdown

for(i=0;i<step;i++)
{
    getchar();
    getchar();
    scanf("%c",&mark[i]);
    scanf("%d %d",&a[i],&b[i]);
    if(mark[i]>='1'&&mark[i]<='9')
    {
        x = a[i];
        while(x!=0)
        {
            x/=10;
            cnt[i]++;
        }
        a[i] += ((mark[i]-'0')*pow(10,cnt[i]));
        mark[i] = flag;
    }
    cnt[i] = 2;
    flag = mark[i];

by TangPoetry @ 2022-01-24 22:59:22

只会c加一


by TangPoetry @ 2022-01-24 23:00:41

用if判断


|