zstu2017新生赛



#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
     long long c[10003];
     for ( long long i = 1; i <= 10002; i++)
         c[i] = i*i*i;
     long long s;
     while (cin >> s)
     {
         bool p = 0;
         for ( int i = 1; i <= 10000; i++)
         {
             long long sum = c[i] + s;
             if (c[i + 1] > sum) break ;
             int x = i + 1, y = 10002;
             while (x < y)
             {
                 int t = (x + y) / 2;
                 if (c[t] >= sum) y = t;
                 else x = t + 1;
             }
             if (c[x] == sum)
             {
                 cout << i << ' ' << x << endl;
                 p = 1; break ;
             }
         }
         if (p == 0) cout << "-1" << endl;
     }
     return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<math.h>
using namespace std;
int main()
{
    int n,m,x,y;
     while ( scanf ( "%d%d%d%d" ,&n,&m,&x,&y)!=EOF)
     {
         if (n>m) swap(n,m);
         if (x>y) swap(x,y);
         if (x==0)
         {
             cout<< '0' <<endl; continue ;
         }
         int s1,s2=999999999;
         if (x<n) s1=x+1;
         else if (x%n==0) s1=n;
         else s1=n+1;
         int a= sqrt (x);
         if (a<n)
         {
             if (a*a==x) s2=2*a;
             else if (x-a*a<=a) s2=2*a+1;
             else s2=2*a+2;
         }
         cout<<min(s1,s2)<<endl;
     }
     return 0;
}
 

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
     int ll, r, s;
     while ( scanf ( "%d%d%d" , &ll, &r, &s) != EOF)
     {
         int start = ll, end = r,u=r; int sum = 0;
         while (u)
         {
             sum = sum + u % 10;
             u = u / 10;
         }
         if (end - sum < s)
         {
             printf ( "%d\n" , end - start + 1); continue ;
         }
         while (ll < r)
         {
             int p = (ll + r) / 2, q = p;
             int S = 0;
             while (p)
             {
                 S = S + p % 10;
                 p = p / 10;
             }
             if (q - S < s) ll = q + 1;
             else r = q;
         }
         if (ll <= start) printf ( "%c\n" , '0' );
         else if (ll > end)
         {
             printf ( "%d\n" , end - start + 1);
         }
         else
         {
             printf ( "%d\n" , ll - start);
         }
     }
     return 0;
}

#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
     string xx; int k;
     while (cin >> xx >> k)
     {
         int len1 = xx.length(); int y = k; char x[222]; int tt = 0;
         for ( int i = 0; i < len1; i++)
         {
             if (xx[i] != '0' || ((i+1<len1)&&(xx[i] == '0' &&xx[i + 1] == '.' )))
             {
                 for ( int j = i; j < len1; j++)
                 {
                     x[tt] = xx[j]; tt++;
                 }
                 break ;
             }
 
         }
         int len = tt;
         if (x[0] != '0' )
         {
             for ( int i = 0; i < y; i++)
             {
                 if (i == 1) cout << '.' ;
                 if (i >= len)
                 {
                     cout << '0' ; continue ;
                 }
                 if (x[i] == '.' )
                 {
                     y++; continue ;
                 }
                 cout << x[i];
             }
             cout << 'e' ;
             int t = 0;
             for ( int i = 0; i < len; i++)
             {
                 if (x[i] == '.' ) break ;
                 t++;
             }
             cout << t - 1;
         }
         else
         {
             int t = 0;
             for ( int i = 0; i < len; i++)
             {
                 if (x[i] != '0' &&x[i] != '.' )
                 {
                     cout << x[i];
                     if (k > 1)
                     {
                         cout << '.' ;
                         if (i + k <= len)
                         {
                             for ( int j = i + 1; j < i + k; j++)
                                 cout << x[j];
                         }
                         else
                         {
                             for ( int j = i + 1; j < len; j++)
                                 cout << x[j];
                             for ( int j = 1; j <= k - len + i; j++)
                                 cout << '0' ;
                         }
                     }
                     break ;
                 }
             }
             int p;
             for (p = 0; p < len; p++)
             {
                 if (x[p] != '0' &&x[p]!= '.' ) break ;
             }
             cout << 'e' << '-' << p - 1;
         }
         cout << endl;
     }
     return 0;
}

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
     int a, b, c;
     while (cin >> a >> b >> c)
     {
         double e = sqrt (3) / 4 * a*a;
         double f = acos (-1.0)*b*b;
         double g = c*c;
         if (e > f&&e > g) cout << "triangle" ;
         else if (f > e&&f > g) cout << "circle" ;
         else cout << "square" ;
         cout << endl;
     }
     return 0;
}

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
     int x1, y1, x2, y2, x3, y3, x4, y4;
     while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4)
     {
         x1 = x1 + 100; x2 = x2 + 100; x3 = x3 + 100; x4 = x4 + 100;
         y1 = y1 + 100; y2 = y2 + 100; y3 = y3 + 100; y4 = y4 + 100;
         int t;
         if (x1 > x2) swap(x1, x2);
         if (y1 > y2) swap(y1, y2);
         if (x3 > x4) swap(x3, x4);
         if (y3 > y4) swap(y3, y4);
         bool a[202][202];
         for ( int i = 0; i <= 201; i++)
             for ( int j = 0; j <= 201; j++)
             {
                 if (i >= x1&&i <= x2&&j >= y1&&j <= y2&&i >= x3&&i <= x4&&j >= y3&&j <= y4)
                     a[i][j] = 1;
                 else a[i][j] = 0;
             }
         int x = 0, y; int mm;
         for ( int i = 0; i <= 201; i++)
         {
             y = 0;
             for ( int j = 0; j <= 201; j++)
             {
                 if (a[i][j] == 1) y++, mm = y;
             }
             if (y != 0) x++;
         }
         if (x > 1 && mm > 1) cout <<(x-1)*(mm-1) ;
         else cout << '0' ;
         cout << endl;
     }
     return 0;
}

#include<iostream>
using namespace std;
int main()
{
     int n;
     while (cin >> n)
     {
         if (n <= 2)
         {
             cout << '0' << endl; continue ;
         }
         if (n % 2 == 0) n = n - 1;
         cout << ( int )(250 - 250.00 / n + 0.5) << endl;
     }
     return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值