1 solutions

  • 0
    @ 2025-11-5 16:07:22

    C :

    #include<stdio.h>
    int main()
    {
    	int T,m,n,p,q,i,day;
    	scanf("%d",&T);
    	while(T--)
    	{
    		scanf("%d%d",&n,&m);
    		scanf("%d",&q);
    		for(i=q;i>0;i--)
    		{
    			scanf("%d",&day);
    			if(day<=n)
    			{
    				printf("1\n");
    			}
    			if(day>n)
    			{
    				p=day%(n+1);
    				if(p>=m)
    				printf("1\n");
    				else
    				printf("2\n");	
    			}
    		}
    	}
    	return 0;
    }
    

    C++ :

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    using namespace std;
    int num[111111];
    int main()
    {
        int T;
        scanf("%d",&T);
        while(T--)
        {
            int n,m;
            scanf("%d%d",&n,&m);
            int oneZero=n+1;
            int oneShi=m+n+1;
            int relativeShi_one=oneShi-oneZero;
            int twoZero=m;
            int twoShi=n+1;
            int relativeShi_two=twoShi-twoZero;
            int len=n+1;
            int quesnum;scanf("%d",&quesnum);
            int ques;
            for(int i=1;i<=quesnum;i++)
            {
                scanf("%d",&ques);
                if(ques<=n)
                {
                    printf("1\n");
                    continue;
                }
                int inONE=(ques-n-1)%len;
                int inTWO=(ques-m)%len;
                if(inONE==0)
                    printf("2\n");
                else if(inONE<relativeShi_one)
                    printf("2\n");
                else
                    printf("1\n");
            }
        }
        return 0;
    }
    
    • 1

    Information

    ID
    17498
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By