Submission #1317390
Source Code Expand
#pragma warning(disable:4996) #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #define MAX_STRING 4000 #define MAX_ELEMENT 100 #define false 0 #define true 1 int main() { char sInput[MAX_STRING+1]=""; char* psInput; int nSalesLimitTime = 0; int nProductNum = 0; int anProductMadeTime[MAX_ELEMENT]; int nCustomerNum = 0; int anCustomerComingTime[MAX_ELEMENT]; int i=0; int nProductIndex = 0; int nCustomerIndex = 0; int isProductLack = false; int isAllCustomerSatisfied = false; for (i=0;i<MAX_ELEMENT;i++){ anProductMadeTime[i]=0; anCustomerComingTime[i]=0; } gets(sInput); nSalesLimitTime = atoi(sInput); gets(sInput); nProductNum = atoi(sInput); gets(sInput); psInput=strtok(sInput," "); for (i=0;i<nProductNum;i++){ anProductMadeTime[i]=atoi(psInput); psInput=strtok(NULL," "); } gets(sInput); nCustomerNum = atoi(sInput); gets(sInput); psInput=strtok(sInput," "); for (i=0;i<nCustomerNum;i++){ anCustomerComingTime[i]=atoi(psInput); psInput=strtok(NULL," "); } while ( !isProductLack && !isAllCustomerSatisfied ) { if ( anProductMadeTime[nProductIndex] <= anCustomerComingTime[nCustomerIndex] && anProductMadeTime[nProductIndex] +nSalesLimitTime >= anCustomerComingTime[nCustomerIndex]){ // shoper can sale a product nProductIndex++; nCustomerIndex++; } else { // product is too old nProductIndex++; } if (nCustomerIndex >= nCustomerNum) { isAllCustomerSatisfied = true; } else if (nProductIndex >= nProductNum){ isProductLack = true; } } if (isProductLack) { printf("no\n"); } else if (isAllCustomerSatisfied){ printf("yes\n"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - おいしいたこ焼きの売り方 |
User | unirita137 |
Language | C (GCC 5.4.1) |
Score | 100 |
Code Size | 1761 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:33:2: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration] gets(sInput); ^ /tmp/cciSSphM.o: In function `main': Main.c:(.text.startup+0x71): warning: the `gets' function is dangerous and should not be used.
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | rand0.txt, rand1.txt, rand10.txt, rand11.txt, rand12.txt, rand13.txt, rand14.txt, rand15.txt, rand16.txt, rand17.txt, rand18.txt, rand19.txt, rand2.txt, rand20.txt, rand21.txt, rand22.txt, rand23.txt, rand24.txt, rand25.txt, rand26.txt, rand27.txt, rand28.txt, rand29.txt, rand3.txt, rand4.txt, rand5.txt, rand6.txt, rand7.txt, rand8.txt, rand9.txt, s1.txt, s2.txt, s3.txt, s4.txt, s5.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
rand0.txt | AC | 1 ms | 128 KB |
rand1.txt | AC | 1 ms | 128 KB |
rand10.txt | AC | 1 ms | 128 KB |
rand11.txt | AC | 0 ms | 128 KB |
rand12.txt | AC | 0 ms | 128 KB |
rand13.txt | AC | 1 ms | 128 KB |
rand14.txt | AC | 0 ms | 128 KB |
rand15.txt | AC | 1 ms | 128 KB |
rand16.txt | AC | 1 ms | 128 KB |
rand17.txt | AC | 1 ms | 128 KB |
rand18.txt | AC | 0 ms | 128 KB |
rand19.txt | AC | 0 ms | 128 KB |
rand2.txt | AC | 1 ms | 128 KB |
rand20.txt | AC | 0 ms | 128 KB |
rand21.txt | AC | 1 ms | 128 KB |
rand22.txt | AC | 1 ms | 128 KB |
rand23.txt | AC | 1 ms | 128 KB |
rand24.txt | AC | 1 ms | 128 KB |
rand25.txt | AC | 0 ms | 128 KB |
rand26.txt | AC | 0 ms | 128 KB |
rand27.txt | AC | 1 ms | 128 KB |
rand28.txt | AC | 1 ms | 128 KB |
rand29.txt | AC | 0 ms | 128 KB |
rand3.txt | AC | 0 ms | 128 KB |
rand4.txt | AC | 1 ms | 128 KB |
rand5.txt | AC | 0 ms | 128 KB |
rand6.txt | AC | 1 ms | 128 KB |
rand7.txt | AC | 1 ms | 128 KB |
rand8.txt | AC | 1 ms | 128 KB |
rand9.txt | AC | 1 ms | 128 KB |
s1.txt | AC | 0 ms | 128 KB |
s2.txt | AC | 0 ms | 128 KB |
s3.txt | AC | 1 ms | 128 KB |
s4.txt | AC | 1 ms | 128 KB |
s5.txt | AC | 0 ms | 128 KB |