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

MMA
Differences between revisions 2 and 34 (spanning 32 versions)
Revision 2 as of 2012-05-08 17:39:52
Size: 443
Editor: rei05
Comment:
Revision 34 as of 2012-07-16 17:50:37
Size: 894
Editor: nomeaning
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=Help Me!= = C言語 =
== 未解決問題 ==
第11行目の有無によって第18行目の出力が異なります。 なぜでしょう?-- [[rei05]] <<DateTime(2012-07-11T13:47:51+0900)>>
Line 3: Line 5:
 * AOJ10020番、WrongAnswer 信心が足りないということでは? -- hiyakashi <<DateTime>>
Line 5: Line 7:
#comment

{{{
異なっていないように見えます。 [[http://ideone.com/sWn2y]]、[[http://ideone.com/hGDDS]] -- [[nomeaning]] <<DateTime(2012-07-16T17:50:37+0900)>>
{{{#!highlight haskell
Line 9: Line 10:
#include<math.h>
Line 11: Line 13:
        double ans=100000;
        int n,i;
Line 12: Line 16:
int num,i,pri;
char ch,counter[256]={0};
        scanf("%d",&n);
Line 15: Line 18:
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]++;
  }
}
        for(i=0;i<n;i++){
                printf("%f\n",fmod(ans*1.05,1000));
                if(fmod(ans*1.05,1000)==0)
                        ans*=1.05;
                else
                        ans=ans*1.05-fmod(ans*1.05,1000)+1000;
        }
Line 27: Line 26:
for(i=0;i<=25;i++){
  pri=counter[i];
  printf("%c : %d\n",i+'a',pri);
}

return(0);
        printf("%d\n",(int)ans);
        return 0;

C言語

未解決問題

第11行目の有無によって第18行目の出力が異なります。 なぜでしょう?-- rei05 2012-07-11 13:47:51

信心が足りないということでは? -- hiyakashi 2020-05-28 08:29:51

異なっていないように見えます。 http://ideone.com/sWn2yhttp://ideone.com/hGDDS -- nomeaning 2012-07-16 17:50:37

   1 #include<stdio.h>
   2 #include<math.h>
   3 
   4 int main(){
   5         double ans=100000;
   6         int n,i;
   7 
   8         scanf("%d",&n);
   9 
  10         for(i=0;i<n;i++){
  11                 printf("%f\n",fmod(ans*1.05,1000));
  12                 if(fmod(ans*1.05,1000)==0)
  13                         ans*=1.05;
  14                 else
  15                         ans=ans*1.05-fmod(ans*1.05,1000)+1000;
  16         }
  17 
  18         printf("%d\n",(int)ans);
  19         return 0;
  20 }

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