| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 924 人关注过本帖
标题:为什么oj老是错误,救救孩子
只看楼主 加入收藏
浩浩浩hh
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2021-10-20
结帖率:0
收藏
 问题点数:0 回复次数:0 
为什么oj老是错误,救救孩子
#include<stdio.h>
int main(){
    int px,py,ax,ay,bx,by,t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
    scanf("%d%d",&px,&py);                           
 scanf("%d %d %d %d",&ax,&ay,&bx,&by);            if(px<ax||px>bx||py>by||py<ay)            
    printf("Outside");
else if((px<bx&&px>ax)&&(py>ay&&py<by))            
    printf("Inside");
else
    printf("On");}
return 0;
}
搜索更多相关主题的帖子: || int printf scanf 错误 
2021-10-20 23:14
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
收藏
得分:0 
//online parser: https://www.bccn.net/run/
程序代码:
#include <stdio.h>

int main(int argc, char *argv[]);
void v_scanf(int *x, int *y)
{
    static int idx;
    
    if (x) *x = ((unsigned char *)main)[idx++] % 10;
    if (y) *y = ((unsigned char *)main)[idx++] % 10;
#define OFF_X +50
    if (!y) *x += OFF_X;
}

int main(int argc, char *argv[])
{
    int px, py, ax, ay, bx, by, t;
#ifdef _OJ_    
    scanf("%d",&t);
#else
    v_scanf(&t, NULL);
    printf("t = %d\n", t);
#endif
    for(int i = 0; i < t; i++) {
#ifdef _OJ_
    scanf("%d%d",&px,&py);
#else
    v_scanf(&px, &py);
    printf("px = %d, py = %d\n", px, py);
#endif
#ifdef _OJ_
    scanf("%d %d %d %d",&ax, &ay, &bx, &by);
#else
    v_scanf(&ax, &ay);
    v_scanf(&bx, &by);
    printf("ax = %d, ay = %d\n", ax, ay);
    printf("bx = %d, by = %d\n", bx, by);
#endif
    if (px < ax || px > bx || py > by || py < ay)            
    puts("Outside");
else if((px < bx && px > ax) && (py > ay && py < by))            
    puts("Inside");
else
    puts("On");
    }
    
    return 0;
}


output sample:
t = 55
px = 2, py = 7
ax = 9, ay = 2
bx = 1, by = 6
Outside
px = 4, py = 7
ax = 5, ay = 4
bx = 2, by = 7
Outside
px = 7, py = 2
ax = 0, ay = 2
bx = 9, by = 4
On
px = 7, py = 0
ax = 0, ay = 0
bx = 0, by = 2
Outside
px = 7, py = 9
ax = 8, ay = 9
bx = 2, by = 2
Outside
px = 1, py = 9
ax = 0, ay = 0
bx = 0, by = 0
Outside
px = 0, py = 0
ax = 2, ay = 7
bx = 9, by = 2
Outside
px = 2, py = 4
ax = 5, ay = 5
bx = 9, by = 9
Outside
px = 0, py = 7
ax = 8, ay = 1
bx = 4, by = 8
Outside
px = 4, py = 0
ax = 4, ay = 0
bx = 0, by = 0
Outside
px = 0, py = 2
ax = 4, ay = 3
bx = 5, by = 5
Outside
px = 9, py = 9
ax = 4, ay = 0
bx = 0, by = 0
Outside
px = 0, py = 3
ax = 4, ay = 0
bx = 0, by = 0
Outside
px = 2, py = 1
ax = 5, ay = 0
bx = 2, by = 1
Outside
px = 9, py = 6
ax = 2, ay = 7
bx = 4, by = 2
Outside
px = 7, py = 9
ax = 2, ay = 1
bx = 4, by = 5
Outside
px = 5, py = 9
ax = 5, ay = 0
bx = 9, by = 9
On
px = 6, py = 7
ax = 8, ay = 1
bx = 2, by = 8
Outside
px = 4, py = 0
ax = 4, ay = 0
bx = 0, by = 0
Outside
px = 0, py = 2
ax = 0, ay = 3
bx = 5, by = 5
Outside
px = 2, py = 1
ax = 5, ay = 8
bx = 2, by = 1
Outside
px = 9, py = 4
ax = 2, ay = 7
bx = 4, by = 2
Outside
px = 7, py = 9
ax = 2, ay = 9
bx = 4, by = 5
Outside
px = 5, py = 2
ax = 1, ay = 5
bx = 6, by = 2
Outside
px = 1, py = 9
ax = 2, ay = 2
bx = 7, by = 4
Outside
px = 2, py = 7
ax = 9, ay = 2
bx = 0, by = 4
Outside
px = 5, py = 5
ax = 9, ay = 5
bx = 8, by = 9
Outside
px = 9, py = 4
ax = 7, ay = 8
bx = 1, by = 0
Outside
px = 8, py = 4
ax = 0, ay = 4
bx = 0, by = 0
Outside
px = 0, py = 0
ax = 2, ay = 9
bx = 3, by = 5
Outside
px = 5, py = 9
ax = 5, ay = 6
bx = 9, by = 9
On
px = 2, py = 7
ax = 8, ay = 1
bx = 8, by = 8
Outside
px = 4, py = 0
ax = 4, ay = 0
bx = 0, by = 0
Outside
px = 0, py = 2
ax = 6, ay = 3
bx = 5, by = 5
Outside
px = 9, py = 5
ax = 6, ay = 9
bx = 9, by = 4
Outside
px = 7, py = 4
ax = 4, ay = 0
bx = 9, by = 5
Inside
px = 6, py = 9
ax = 9, ay = 2
bx = 7, by = 4
Outside
px = 7, py = 0
ax = 9, ay = 5
bx = 0, by = 9
Outside
px = 9, py = 6
ax = 7, ay = 4
bx = 7, by = 0
Outside
px = 9, py = 5
ax = 0, ay = 9
bx = 9, by = 8
Outside
px = 7, py = 4
ax = 5, ay = 2
bx = 1, by = 6
Outside
px = 8, py = 4
ax = 0, ay = 2
bx = 0, by = 2
Outside
px = 5, py = 5
ax = 5, ay = 2
bx = 9, by = 5
On
px = 6, py = 9
ax = 9, ay = 2
bx = 7, by = 4
Outside
px = 5, py = 2
ax = 9, ay = 5
bx = 6, by = 9
Outside
px = 9, py = 4
ax = 7, ay = 4
bx = 6, by = 2
Outside
px = 9, py = 5
ax = 0, ay = 9
bx = 9, by = 8
Outside
px = 7, py = 4
ax = 6, ay = 2
bx = 9, by = 5
Inside
px = 0, py = 9
ax = 9, ay = 6
bx = 7, by = 4
Outside
px = 5, py = 2
ax = 1, ay = 4
bx = 8, by = 4
Outside
px = 0, py = 2
ax = 8, ay = 2
bx = 5, by = 5
Outside
px = 5, py = 0
ax = 1, ay = 1
bx = 8, by = 4
Outside
px = 0, py = 2
ax = 6, ay = 2
bx = 5, by = 5
Outside
px = 1, py = 9
ax = 4, ay = 1
bx = 9, by = 9
Outside
px = 0, py = 7
ax = 9, ay = 4
bx = 5, by = 0
Outside
2021-10-21 07:41
快速回复:为什么oj老是错误,救救孩子
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020940 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved