
数学模拟题;
最大面积就是在a与b成一条直线的情况下;
so : 输出pi * (a+b) * (a+b)即可
注意 : 注意精度!!!
- #include
- #include
- using namespace std;
- const double pi = 3.141592653589793238462643383279502884197169399;
- int main(){
- int a,b;
- cin>>a>>b;
- double ans = 1.0 * pi * ((a+b)*(a+b)) ;
- printf("%.10f",ans);
- return 0;
- }

数据量小,模拟即可;
具体模拟过程请看代码 :
- #include
- #include
- #include
- typedef long long LL;
- using namespace std;
- int cnt(string t){
- int cnt = 0;
- for(char c : t) if(c=='0') cnt ++;
- return cnt;
- }
- string tran(string &t,char c){
- if(c=='a'){
- if(t[1]-'0' >=0 && t[1]-'0'<= 8) t[1]++;
- else{
- t[0]++;
- t[1] = '0';
- }
- }else {
- if(t[3]=='9'){
- t[2]++;
- t[3]='0';
- }else t[3]++;
- }
- return t;
- }
-
- int main(){
- string s ;
- LL ans;
- cin>>s;
- string t = "0000";
- for(char c : s){
- tran(t,c);
- ans += cnt(t);
- }
- cout << ans << endl;
- }
用一个set集合来实现去重和排序,然后模拟加入的过程;
- #include
- typedef long long ll;
- using namespace std;
- int main() {
- ll k, a, b, l;
- cin>>k>>a>>b;
- set
s; - s.insert(a);
- s.insert(b);
- while (k--) {
- l = *s.begin();
- s.erase(s.begin());
- s.insert(l+a);
- s.insert(l+b);
- }
- cout<<(l);
- return 0;
- }
-
- // 2 3 4 5