zoukankan      html  css  js  c++  java
  • Google Code Jam 第一题

    通过的第一题,留做纪念,呵呵,非常简单,Africa 2010, Qualification Round: Store Credit。

     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 
     4 int main(void)
     5 {
     6     int N,C,I;
     7     int *p;
     8     int i,j,k;
     9     freopen("in.in", "r", stdin);
    10     freopen("out", "w", stdout);
    11     scanf("%d",&N);
    12     for(i=1;i<=N;i++)
    13     {
    14 
    15         scanf("%d",&C);
    16         scanf("%d",&I);
    17 
    18         p=(int *)malloc(sizeof(int)*I);
    19         for(j=0;j<I;j++)
    20         {
    21             scanf("%d",p+j);
    22 
    23             for(k=0;k<j;k++)
    24                 if(p[k]+p[j]==C)
    25                     goto out;
    26         }
    27 
    28 out:    printf("Case #%d: %d %d
    ",i,k+1,j+1);
    29 
    30         while (getchar()!='
    ')
    31             ;
    32         free(p);
    33         
    34     }
    35 }
    Credit.c
  • 相关阅读:
    59
    58
    57
    56
    55
    54
    53
    转 Using $.ajaxPrefilter() To Configure AJAX Requests In jQuery 1.5
    jquery用正则表达式验证密码强度
    什么是高内聚、低耦合?(转载)
  • 原文地址:https://www.cnblogs.com/zackcoder/p/3247380.html
Copyright © 2011-2022 走看看