#include<iostream> #include<iomanip> using namespace std; int main() { int n; float d = 0; cin>>n; for(int i = 0;i<n;i++) { int a; cin>>a; d = d + a; } d = d / n; cout<<fixed<<setprecision(2)<<d; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int m,n,s=0; cin>>m>>n; for(int i=m;i<=n;i++) { if(i%2==1) { s=s+i; } } cout<<s; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int n,i,s1=0,s5=0,s10=0,x; cin>>n; for(i=1;i<=n;i++) { cin>>x; if(x==1)s1++; if(x==5)s5++; if(x==10)s10++; } cout<<s1<<endl; cout<<s5<<endl; cout<<s10<<endl; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int a,i,n,s=1; cin>>a>>n; for(i=1;i<=n;i++) { s=s*a; } cout<<s; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int r, m, y; cin >> r >> m >> y; double m1 = (double)m; for (int i = 0;i < y;i++) { m1 = (1 + 0.01 * r) * m1; } m = m1; cout << m << endl; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int sum; int n; cin>>sum>>n; int cnt = 0; for(int i = 0;i<n;i++) { int a; cin>>a; if(sum>=a) { sum = sum - a; } else { cnt++; } } cout<<cnt; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int n; cin>>n; int cnt = 0; int max = 0; for(int i = 0;i<n;i++) { int a,b; cin>>a>>b; if(90<=a && a<=140 && 60<=b && b<=90) { cnt++; if(max<cnt) { max = cnt; } } else { cnt = 0; } } cout<<max; return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { for(int i = 100;i<=342;i++) { int g7 = i%7; int s7 = i/7%7; int b7 = i/7/7%7; int g9 = i%9; int s9 = i/9%9; int b9 = i/9/9%9; if(g7 == b9&&s7 == s9&&b7 == g9) { cout<<i<<endl; cout<<b7<<s7<<g7<<endl; cout<<b9<<s9<<g9<<endl; } } }
#include<iostream> #include<iomanip> using namespace std; int main() { int n,m; cin>>n>>m; int cnt2 = 0; for(int i = 1;i<=n;i++) { int cnt = 0; for(int j = 1;j<=m;j++) { if(i%j == 0) { cnt++; } } if(cnt%2 == 1) { cnt2++; if(cnt2 == 1) { cout<<i; } else { cout<<","<<i; } } } return 0; }
#include<iostream> #include<iomanip> using namespace std; int main() { int n; cin>>n; int cnt = 0; int sum = 0; for(int i = 1;true;i++) { for(int j = 0;j<i;j++) { sum = sum + i; cnt++; if(cnt == n) { cout<<sum; return 0; } } } return 0; }