Login
Immutable PageDiscussionInfoAttachments
Diff for "rei05/C言語"

MMA
Differences between revisions 2 and 27 (spanning 25 versions)
Revision 2 as of 2012-05-08 17:39:52
Size: 443
Editor: rei05
Comment:
Revision 27 as of 2012-05-30 23:23:11
Size: 1026
Editor: rei05
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=Help Me!= = C言語 =
== AOJ解答 ==
 . 最終的にAcceptedとなった回答です。
Line 3: Line 5:
 * AOJ10020番、WrongAnswer  . ここはこうした方がいいなど改善すべき点がありましたら是非ご教授お願いします。
Line 5: Line 7:
#comment  * [[/10020]]
 * [[/10021]]
 * [[/10022]]
 * [[/10023]]
 * [[/10024]]
 * [[/10025]]
 * [[/10026]]
 * [[/10027]]
 * [[/10028]]
Line 7: Line 17:
{{{ == Help Me! ==
=== 未解決 ===
 * AOJ10029番 Time Limit Exceeded
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10029



 * [[/Discussion]]
  * わざわざ1ページ作っての説明ありがとうございます。参考にさせていただきます。

{{{#!highlight haskell
Line 9: Line 29:
Line 12: Line 31:
int num,i,pri;
char ch,counter[256]={0};
int n,i,j,k,l,temp;
scanf("%d",&n);
Line 15: Line 34:
while(1){
  scanf("%c",&ch);
    if(ch=='\n') break;
  if('a'<=ch&&ch<='z'){
    num=ch-'a';
    counter[num]++;
  }else if('A'<=ch&&ch<='Z'){
    num=ch-'A';
    counter[num]++;
int num[n];
for(i=0;i<n;i++){
  scanf("%d",&num[i]);
}

for(j=0;j<n;j++){
  for(k=0;k<j;k++){
    if(num[j]<num[k]){
      temp=num[j];
      num[j]=num[k];
      num[k]=temp;
    }
Line 27: Line 49:
for(i=0;i<=25;i++){
  pri=counter[i];

  printf("%c : %d\n",i+'a',pri);
for(l=0;l<n-1;l++){
  printf("%d ",num[l]);
Line 31: Line 52:
printf("%d\n",num[n-1]);

C言語

AOJ解答

Help Me!

未解決

   1 #include<stdio.h>
   2 int main(){
   3 
   4 int n,i,j,k,l,temp;
   5 scanf("%d",&n);
   6 
   7 int num[n];
   8 for(i=0;i<n;i++){
   9   scanf("%d",&num[i]);
  10 }
  11 
  12 for(j=0;j<n;j++){
  13   for(k=0;k<j;k++){
  14     if(num[j]<num[k]){
  15       temp=num[j];
  16       num[j]=num[k];
  17       num[k]=temp;
  18     }
  19   }
  20 }
  21 
  22 for(l=0;l<n-1;l++){
  23   printf("%d ",num[l]);
  24 }
  25 printf("%d\n",num[n-1]);
  26 
  27 return(0);
  28 }

rei05/C言語 (last edited 2012-07-16 17:50:37 by nomeaning)