zoukankan      html  css  js  c++  java
  • sicily 6767. Making Decisions

    模拟赛第一题,捡分题……

    Description
    In the olden days making decisions was easy. One would get a daisy and start to pluck its petals alternating between Do-it and Do-it-Not until the last petal was reached and a decision was made.
    Gadget-man wants to use a computerised version. The idea is to work with a random string of zeros and ones. He will pick up two bits, one from each end of the string, and compare them. If they are the same (that is, both ones or both zeros), then it is Do-it. If they differ, then it is Do-it-Not. The two bits are then discarded and the process is repeated on the remaining string until all the bits are picked. The last two bits to be picked will be the decision maker. By the way, the string may be random but it always contains an even number of bits that is greater than zero.
    Your task is to write a program that reads a string of zeros and ones and makes the decision for Gadget-man.

    Input
    The input starts with an integer N, on a line by itself, that represents the number of test cases. 1 <= N <= 1000. The description for each test case consists of a string of zeros and ones. There are no blank spaces separating the bits.

    Output
    The output consists of a single line, for each test case, which contains a string Do-it or a string Do-it-Not.

    View Code
     1 #include<stdio.h>
     2 int main()
     3 {
     4     double x, y;
     5     double min;
     6     int n;
     7     
     8     scanf("%lf %lf", &x, &y);
     9     min = x / y;
    10     
    11     scanf("%d", &n);
    12     
    13     while(n--)
    14     {
    15         scanf("%lf %lf", &x, &y);
    16         if( x/y < min )
    17         {
    18             min = x/y;
    19         }
    20     }
    21     
    22     printf("%.2lf\n", min*1000);
    23     
    24     return 0;
    25 }
  • 相关阅读:
    实现报表数据外置计算
    实现报表数据的可控缓存
    实现报表数据分库存储
    实现报表数据预先计算
    实现报表与算法的统一管理
    如何实现报表直接打印需求
    交叉填报表的制作
    格间计算性能提升方案
    填报脚本之轻松搞定复杂表的数据入库
    treeview_dropdown_control
  • 原文地址:https://www.cnblogs.com/joyeecheung/p/2813727.html
Copyright © 2011-2022 走看看