1.c语言北大ACM—OJ-1002的北大北一个小问题
2.å
³äºå大OJï¼Online Judgeï¼
3.北大oj1008 题,c语言,源码vf 随机抽 源码总是系统源码分析实例wrong answer
4.hustojä¸å大ojï¼åªä¸ªå¥½ç¨
c语言北大ACM—OJ-1002的一个小问题
本人的烂代码,参考下下。北大北源码bug查询感觉你的源码gzip实现源码效率很低,而且部分地方还有问题。系统select源码实现
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int map[]={ 2,北大北2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
int cmp ( const void *a , const void *b )
{
return *(int *)a - *(int *)b;
}
int main()
{
int n, *d,i,j,maxNum=0,dul,temp;
char key[];
scanf("%d",&n);
d=(int *)malloc(sizeof(int)*n);
for (i=0;i<n;i++)
{
d[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%s",key);
for (j=0;j<strlen(key);j++)
{
if (key[j]!='-')
{
if (key[j]>='A')
{
d[i]=d[i]*+map[key[j]-'A'];
}
else
{
d[i]=d[i]*+key[j]-'0';
}
}
}
}
//快排
qsort(d,n,sizeof(int),cmp);
temp=d[0]; dul=1;
for (i=1;i<n;i++)
{
if (d[i]==temp)
{
dul++;
}
else
{
if (dul>1)
{
maxNum=dul>maxNum?dul:maxNum;
printf("%d-%d %d\n",d[i-1]/,d[i-1]%,dul);
}
temp=d[i];
dul=1;
}
}
if (dul>1)
{
maxNum=dul>maxNum?dul:maxNum;
printf("%d-%d %d\n",d[i-1]/,d[i-1]%,dul);
}
if (maxNum<2)
{
printf("No duplicates. \n");
}
}
å ³äºå大OJï¼Online Judgeï¼
èªå·±æ é¿åªä¸ªå°±ç¨åªä¸ªãé½ä¸æ ·ï¼åªè¦ä½ ç代ç è½Acceptå°±OKï¼å¬è¯´è¿ä¸å ³å¾éè¦ï¼å¦æå¤è¯åºäº5个é¢ï¼ä½ å对äºè³å°4个é¢ï¼ä¸è¬å¯¼å¸å°±ä¼å¾çå¥½ä½ ï¼çè³æ¯è¡¨æ¬ä½
北大oj 题,c语言,源码总是系统wrong answer
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
int n, i, j, a, num, m, day;
char t[7];
char Haab[][7] = { "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"};
char Tzolkin[][9] = { "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" };
scanf("%d", &n);
printf("%d\n", n);
for (j = 0; j < n; j++) {
scanf("%d . %s %d", &num, t, &a);
for (i = 0; i < ; i++)
if (strcmp(t, Haab[i]) == 0)
break;
num = num + i * + a * + 1;
day = num % ;
if (day == 0) day = ;
printf("%d %s %d\n", day, Tzolkin[(num - 1) % ], (num - 1) / );
}
return 0;
}
hustojä¸å大ojï¼åªä¸ªå¥½ç¨
两个OJé½å¾å¤äººå¨ç¨ãå大OJæºå¥½çï¼é¢ç®ä¸éï¼ç½ä¸é¢è§£ä¹å¾å¤ï¼ä¸ä¼çå¯ä»¥æ¥ï¼å¾æ¹ä¾¿ãhustojä¸è¬ç¨æ¥ææ¯èµçæ¯è¾å¤ï¼ææ¶ååå¦å¯ä»¥æææ¯èµï¼ä¹å¯ä»¥èªå·±æåï¼åç£åç£ï¼æ¯è¾ææ¯èµçæè§ï¼æ¯èµçé¢ç®å¯ä»¥æ¥èªå个OJï¼å¾å¼ºå¤§~