結果
問題 | No.347 微分と積分 |
ユーザー | notetonous |
提出日時 | 2016-04-03 00:36:44 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 139 ms |
コンパイル使用メモリ | 24,320 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 03:09:43 |
合計ジャッジ時間 | 981 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:26:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:27:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d",&b); | ^~~~~~~~~~~~~~ main.c:28:19: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | for(i=0;i<n;i++)scanf("%lf",&a[i]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> void bibun(double a[10],int b,int n ){ int i,j; double ans=0; for(i=0;i<n;i++){ ans=ans+a[i]*pow(b,a[i]-1); } printf("%lf\n",ans); } void sekibun(double a[10],int b,int n){ int i,j; double ans=0; for(i=0;i<n;i++){ if(a[i]==-1.0) ans=ans+log(b); else ans=ans+pow(b,a[i]+1)/(a[i]+1); } printf("%lf\n",ans); } int main(){ int n; int b; int i,j; double a[10]; scanf("%d",&n); scanf("%d",&b); for(i=0;i<n;i++)scanf("%lf",&a[i]); bibun(a,b,n); sekibun(a,b,n); return 0; }