第一行一个整数n,代表S的长度。
第二行输入n个字符,字符要么是(,要么是)。代表串S。
一行一个整数,代表不同的方案数。答案对10^9+7取模。
20%: n <= 20
40%: n <= 100
60%: n <= 1000
100%: n <= 10000
传说中的送分题,要AC;
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> using namespace std; int n; double T,S,m; double g,s,sum,ans; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>g>>s; sum+=s; ans+=g*s; } double p=ans/sum; printf("%.1f",p); }
万能头文件也可以:#include<bits/stdc++.h>
原文:https://www.cnblogs.com/FXY-180/p/9608988.html