Miss Kitty and Her Little Ice Cream Shop(水题)

Miss Kitty 在大学毕业后面临岛国 T 教育需求低迷的问题,转而开设冰淇淋店以赚取学费。她利用天气与销售模式的数学公式预测每日收益,目标至少累积 m 元。本文探讨如何计算达到此财务目标所需的天数。
Miss Kitty and Her Little Ice Cream Shop
Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Description

Download as PDF

Miss Kitty graduated from University N that has a long history of training their students to become teachers in an island country T. All of her classmates, including Miss Kitty, work very hard at school to become teachers of primary or secondary schools. However, due to the extremely low birth rate in island T, there is little demand for teachers in the island T. Miss Kitty has changed her career plan after unable to secure a stable job in the teaching market after more than 5 years of struggling. She wants to acquire other practical skills by entering graduate schools. However, the tuition for higher education in island T is very high. She needs to save money before becoming a student again. She has opened an ice cream shop near University N. She saves all of the money she earned and will close the shop and enter a graduate institute of making ice creams after she has earned at least m dollars.

She works very hard every day by selling ice creams and opens the shop every day. Nearby customers become to love her ice cream day after day. After a few days, she discovered the following magic formulas about the amount of money she earned each day. Assume x is the number of days the shop is opened. So x = 1 for the first day the shop is opened.

  • During a sunny day, her shop earns exactly a . x2 + b . x + c dollars.
  • During a cloudy day, her shop earns exactly d . x2 + e . x + f dollars.
  • During a raining day, her shop earns exactly g . x2 + h . x + i dollars.

The following is an example when a = 1 , b = 2 , c = 1 , d = 1 , e = - 2 , f = 1 , g = 0 , h = 1 and i = 1 :


x1234567
x2 + 2x + 1 (sunny)491625364964
x2 - 2x + 1 (cloudy)0149162536
x + 1 (raining)2345678


Each day is either a sunny, cloudy or raining day. Furthermore, she also discovers the following magic formulas between x and the weather.


  • If (j . x + k) can be evenly divided by 3, i.e., (j . x + k) mod 3 = 0, then it is a sunny day.
  • If (j . x + k) mod 3 = 1, then it is a cloudy day.
  • If (j . x + k) mod 3 = 2, then it is a rainy day.


Note that mod is the operator to find the reminder of integer division. The following is an example when j = 2 and k = 1 :


x1234567
2x + 13579111315
(2x + 1) mod 30210210
weathersunnyrainingcloudysunnyrainingcloudysunny


Please use the above formulas to calculate for Miss Kitty, the least integer x so that the total amount of money earned by her is at least m .

The following is an example when m = 100 using the same values for a, ... k as above:


x1234567
weathersunnyrainingcloudysunnyrainingcloudysunny
money earn today4342562564
total money earned4711364267131


Hence the answer is x = 7 . Miss Kitty needs to open the ice cream for at least 7 days.


Technical Specification

  1. 0 < m$ \le$10, 000, 000 and m is an integer
  2. -10$ \le$abcdefghijk$ \le$10 , and they are all integers

Input

The first line of the input file contains an integer indicating the number of test cases to follow. Then each of the next line contains


m a b c d e f g h i j k

Output

For each test case, output the least x so that the total amount of money earned is at least m .

Sample Input

2 
100 1 2 1 1 -2 1 0 1 1 2 1 
1234 2 1 2 2 -2 0 1 -5 0 4 8

Sample Output

7 
14

//Memory: 0 KB		Time: 12 MS
//Language: ANSI C 4.1.2		Result: Accepted

#include <stdio.h>

int main()
{
    int m, a, b, c, d, e, f, g, h, i, j, k, x, sum, T;
    scanf("%d", &T);
    while(T--)
    {
        x=1;sum=0;
        scanf("%d%d%d%d%d%d%d%d%d%d%d%d", &m, &a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k);
        while(sum < m)
        {
            int w = (j*x + k)%3;
            if(!w)
                sum += (a*x*x + b*x + c);
            else if(w == 1)
                sum += (d*x*x + e*x + f);
            else
                sum += (g*x*x + h*x + i);
            x++;
        }
        printf("%d\n", x - 1);
    }
    return 0;
}


基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)内容概要:本文围绕“基于数据驱动的Koopman算子的递归神经网络模型线性化”展开,旨在研究纳米定位系统的预测控制方法。通过结合数据驱动技术与Koopman算子理论,将非线性系统动态近似为高维线性系统,进而利用递归神经网络(RNN)建模并实现系统行为的精确预测。文中详细阐述了模型构建流程、线性化策略及在预测控制中的集成应用,并提供了完整的Matlab代码实现,便于科研人员复现实验、优化算法并拓展至其他精密控制系统。该方法有效提升了纳米级定位系统的控制精度与动态响应性能。; 适合人群:具备自动控制、机器学习或信号处理背景,熟悉Matlab编程,从事精密仪器控制、智能制造或先进控制算法研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①实现非线性动态系统的数据驱动线性化建模;②提升纳米定位平台的轨迹跟踪与预测控制性能;③为高精度控制系统提供可复现的Koopman-RNN融合解决方案; 阅读建议:建议结合Matlab代码逐段理解算法实现细节,重点关注Koopman观测矩阵构造、RNN训练流程与模型预测控制器(MPC)的集成方式,鼓励在实际硬件平台上验证并调整参数以适应具体应用场景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值