Finally,Which light is on?


Finally,Which light is on?

Accepted : 238 Submit : 1065
Time Limit : 1000 MS Memory Limit : 65536 KB


Finally, which light is on?

题目描述

有n盏灯,编号1~n。一开始灯都是关着的,每个灯有一个开关,按奇数次为打开,按偶数次为关闭。我们先把编号为1的倍数的灯按一下开关,再把编号为2的倍数的灯按一下开关,依次下去,一直到把编号为n的倍数灯按一下,请问最后有多少盏灯是亮的?

lamp

输入

第一行是一个整数 T(1T10000) ,表示样例的个数。 以后的每行一个样例,为一个整数 n(1n109)

输出

每行输出一个样例的结果。

样例输入

2
1
5

样例输出

1
2

样例解释

第2个样例,先把1~5都打开;然后把2,4关掉;然后把3关掉;然后把4打开;然后把5关掉;所以,最后剩1和4是亮着的。

来源:湘潭大学 2016年新生趣味程序设计竞赛http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1258

模拟找规律,不知道怎么证明,求告知。

一(感觉复杂了)

#include<bits/stdc++.h>
using namespace std;
int a[1000010];
int main()
{
    a[0]=3,a[1]=8;
    int p=6,i=1,t,n;
    while(a[i]<=1000100000)
    {
        i++;
        a[i]=a[i-1]+1+p;
        p+=2;
    }
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int num=lower_bound(a,a+i+2,n)-a+1;
        printf("%d\n",num);
    }
}

二(这个挺好)

#include<bits/stdc++.h>
using namespace std;
int main()  
{  
    int T;  
    scanf("%d",&T);  
    while(T--)  
    {  
        int n,m=3,i;  
        int sum=0;  
        scanf("%d",&n);  
        for( i=0;sum<n;i++)  
            sum+=m,  
            m+=2;  
        printf("%d\n",i);  
    }  
}  



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
润色下面英文:The controlled drug delivery systems, due to their precise control of drug release in spatiotemporal level triggered by specific stimulating factors and advantages such as higher utilization ratio of drug, less side-effects to normal tissues and so forth, provide a new strategy for the precise treatment of many serious diseases, especially tumors. The materials that constitute the controlled drug delivery systems are called “smart materials” and they can respond to the stimuli of some internal (pH, redox, enzymes, etc.) or external (temperature, electrical/magnetic, ultrasonic and optical, etc.) environments. Before and after the response to the specific stimulus, the composition or conformational of smart materials will be changed, damaging the original balance of the delivery systems and releasing the drug from the delivery systems. Amongst them, the photo-controlled drug delivery systems, which display drug release controlled by light, demonstrated extensive potential applications, and received wide attention from researchers. In recent years, photo-controlled drug delivery systems based on different photo-responsive groups have been designed and developed for precise photo-controlled release of drugs. Herein, in this review, we introduced four photo-responsive groups including photocleavage groups, photoisomerization groups, photo-induced rearrangement groups and photocrosslinking groups, and their different photo-responsive mechanisms. Firstly, the photocleavage groups represented by O-nitrobenzyl are able to absorb the energy of the photons, inducing the cleavage of some specific covalent bonds. Secondly, azobenzenes, as a kind of photoisomerization groups, are able to convert reversibly between the apolar trans form and the polar cis form upon different light irradiation. Thirdly, 2-diazo-1,2-naphthoquinone as the representative of the photo-induced rearrangement groups will absorb specific photon energy, carrying out Wolff rearrangement reaction. Finally, coumarin is a promising category photocrosslinking groups that can undergo [2+2] cycloaddition reactions under light irradiation. The research progress of photo-controlled drug delivery systems based on different photo-responsive mechanisms were mainly reviewed. Additionally, the existing problems and the future research perspectives of photo-controlled drug delivery systems were proposed.
最新发布
02-06

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值