1 solutions

  • 0
    @ 2025-11-5 18:48:06

    C :

    #include<stdio.h>
    #include<math.h>
    main()
    {
    	int i,a,b,c;
    	double s=0;
    	scanf("%d %d %d",&a,&b,&c);
    	for(i=1;i<=a;i++)
    		s+=i;
    	for(i=1;i<=b;i++)
    		s+=pow(i,2);
    	for(i=1;i<=c;i++)
    		s+=1.0/i;
    	printf("%.2f\n",s);
    }
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int a,b,c;
    double t;
    int main()
    {
    	cin>>a>>b>>c;
    	t+=(1+a)*a/2;
    	for(int i=1;i<=b;i++)
    	t+=i*i;
    	for(double i=1;i<=c;i++)
    	t+=1/i;
    	printf("%.2f",t);
    	return 0;
    }
    
    • 1

    Information

    ID
    19046
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By