Achievement statistics

Xiao Lan organized an exam for the students , The total score of roll surface is 100 branch , Each student's score is one 0 reach 100 Integer of .
If the score is at least 60 branch , It is called passing . If the score is at least 85 branch , Is called excellent .
Please calculate the pass rate and excellent rate , Expressed as a percentage , The part before the percent sign is rounded to an integer .

Input format

The first line of input contains an integer n, Indicates the number of examinees .
next n that 's ok , Each row contains one 0 to 100 Integer of , Indicates a student's score .

Output format

Output two lines , One percentage per line , They represent the pass rate and excellent rate respectively .
The part before the percent sign is rounded to an integer .

sample input
7 80 92 56 74 88 100 0
sample output
71% 43% #include <iostream> #include <bits/stdc++.h> #include <algorithm>
#include <vector> #include <cmath> #include <queue> #include <bitset> using
namespace std; typedef long long ll; int main() { int n, jige = 0, youxiu = 0;
cin >> n; int m = n; while(n --) { int a; cin >> a; if(a >= 60) jige ++; if(a
>= 85) youxiu ++; } double sum1 = jige * 1.00 / m * 100; double sum2 = youxiu *
1.00 / m * 100; printf("%.0lf%\n%.0lf%\n",sum1, sum2); return 0; }

Substring score sum

For a string S , We define S Score of f (S ) by S Number of different characters in .
for example f (”aba”) = 2, f (”abc”) = 3, f (”aaa”) = 1.
Now give a string S [0 : n - 1]（ Count Reg n）, Please calculate for all of you S Non empty substring of S [i : j](0 ≤ i ≤ j < n), f (S
[i:: j]) What is the sum of .

Input format

The input line contains a string of lowercase letters S .
For all profiling cases ,1 ≤ n ≤ 100000.

Output format

Output an integer to represent the answer .

sample input
ababc
sample output
28 #include <iostream> #include<cstring> using namespace std; typedef long
long ll; int main() { string s; cin >> s; ll total = 0; int a[26];
memset(a,-1,sizeof(a)); a[s[0] - 'a'] = 0; total += s.size(); for(int
i=1;i<s.size();i++) { total += (i - a[s[i] - 'a']) * (s.size() - i); a[s[i] -
'a'] = i; } cout << total; return 0; }

Technology
Daily Recommendation