結果

問題 No.647 明太子
ユーザー funakoshifunakoshi
提出日時 2019-09-03 14:32:42
言語 C
(gcc 12.3.0)
結果
OLE  
実行時間 -
コード長 1,155 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 29,956 KB
実行使用メモリ 6,176 KB
最終ジャッジ日時 2023-08-25 16:59:02
合計ジャッジ時間 13,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 OLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    int member,kind;
    int price[10001]={0};
    int karasa[10001]={0};
    int mentaip[1001]={0};
    int mentaik[1001]={0};
    scanf("%d",&member);
    for(int i=0;i<member;i++)
    {
        scanf("%d %d",&price[i],&karasa[i]);
    }
    scanf("%d",&kind);
    for(int i=0;i<kind;i++)
    {
        scanf("%d %d",&mentaip[i],&mentaik[i]);
    }
    int kiseki[1005]={0};
    int buycnt[1001]={0};
    for(int i=0;i<kind;i++)
    {
        for(int j=0;j<member;j++)
        {
            if(mentaik[i]>=karasa[j]&&mentaip[i]<=price[j])
            {
                buycnt[i]++;
            }
        }
    }
    int max=0,buy=0;
    for(int i=0;i<kind;i++)
    {
        if(buycnt[i]>max)
        {
            kiseki[0]=i+1;
            max=buycnt[i];
            buy=1;
        }
        else if (buycnt[i]==max)
        {
            kiseki[buy]=i+1;
            buy++;
        }
        else
        {
            buy=0;
        }
        
    }
    int i=0;
    while(kiseki[i]!=0)
    {
        printf("%d\n",kiseki[i]);
    }
}
0