1. 程式人生 > 資訊 >蘋果:iOS 15“查詢”網路對 AirPods 的支援將推遲到今秋稍晚時候

蘋果:iOS 15“查詢”網路對 AirPods 的支援將推遲到今秋稍晚時候

1.題目描述

計算:s=x-x2+x3-x5+x8-……(0.1<x<0.5),要求精度10-8

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    double x,n=1.0,s=0,t=1.0;
    int cnt=0;
    cin>>x;
    if(x<=0.1
|| x>=0.5) return 0; while(fabs(t)>1e-8){ cnt++; t*=x; if(cnt&1) s+=t; else s-=t; } cout<<setprecision(8)<<s<<endl; getchar(); getchar(); }

2.題目描述

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include
<cstring> using namespace std; int main(){ int n,a=2,b=1; double x,s=0.0; cin>>n>>x; for(int i=1;i<=n;i++){ double t=1.0; for(int j=1;j<=a;j++) t*=x; s+=double(t/b); int c=a+b; b=a,a=c; } cout<<s<<endl; getchar(); getchar(); }

3.題目描述

編寫程式,s = 123x + + 123 + 12 + 1 (123x 表示 各位數字由最高位1遞增到個位x )

由鍵盤輸入 x的值(在 1 9 之間),例如 x = 6, 則以上表達式為:

s = 123456+12345+1234+123+12+1

其和值是: 137171

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main(){
    int n,t=1,s=0;
    cin>>n;
    if(n<1 || n>9)    return 0;
    for(int i=1;i<=n;i++){
        s+=t;
        t*=10;
        t+=(i+1);
    }
    cout<<s<<endl;
    getchar();
    getchar();
}