UPC10880 LED

探讨了一种新型LED——ACMOLED,在不同电压下亮度变化的问题。通过实验收集数据并设计程序来估算ACMOLED的两个亮度阈值电压及强度值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UPC10880 LED

时间限制: 2 Sec  内存限制: 512 MB
提交: 246  解决: 13
[提交] [状态] [命题人:admin]
题目描述
A Light-Emitting Diode (LED) is a semiconductor light source, which emits light when an electric current of voltage higher than a threshhold is applied to its leads. ACM R&D recently reported that they have succesfully developed a new LED, namely, ACMOLED. An ACMOLED has a special behavior that the intensity of light emitted from it changes in two steps as the voltage of the electric current increases, as depicted in the graph below.
As shown, an ACMOLED is not activated in the voltage range from 0 to V1, while it emits light with intensity L1 ≥ 0 when the voltage reaches the first threshold V1 and light with intensity L2 ≥ L1 when the voltage reaches the x threshold V2. More specifically, if F(v) is the function that maps voltage v to the intensity of light emitted from an ACMOLED, then for four real numbers L1, L2, V1, and V2 with 0 ≤ L1 ≤ L2 and 0 < V1 < V2, we have
The very issue now is that ACM R&D still does not know the exact values of two threshold voltage values V1 and V2 and the two intensity values L1 and L2 as well. Researchers in ACM R&D plan to estimate these four values for ACMOLEDs by repeated experiments.
Experiments are performed by applying current of a specific voltage and observing the intensity of light emitted from an ACMOLED. After n repeated experiments with different voltage values, obtained are the data of n tuples (v1, l1), (v2, l2), ..., (vn, ln), where li is the observed intensity for voltage vi. Due to the impreciseness of the observing device and other reasons, the experimental data are not accurate and may contain some error. Nonetheless, they want to find a best estimated intensity function F(v) that minimizes the following error function:
where |x| denotes the absolute value of a real number x.
For a given data of n tuples, write a program that finds an estimated intensity function F that minimizes the above error function and outputs the value of error(F).

 

输入
Your program is to read from standard input. The input starts with a line containing an integer n (1 ≤ n ≤ 300,000), where n is the number of tuples (vi, li) in the experimental data. In the following n lines, each line contains two integers, which range inclusively from 0 to 109, representing vi and li in each tuple (vi, li) of the experimental data. Note that you may assume that there are no two tuples (vi, li) and (vj, lj) in the input such that 1 ≤ i < j ≤ n and vi = vj.

 

输出
Your program is to write to standard output. Print exactly one line consisting of one real number, rounded to the first decimal place, which represents the minimum value of error(F).

 

样例输入

复制样例数据

5
0 0
2 1
3 5
6 7
7 11
样例输出
1.0




#include<bits/stdc++.h>
 
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 3e5 + 1000;
int n;
struct node {
    double v, l;
} e[maxn];
 
bool cmp(node a, node b) {
    return a.v < b.v;
}
 
bool check(double x) {
   // cout << "x " << x << endl;
    int cnt = 1;
    double maxx = -1, minn = inf;
    int i = 0;
    double last = -1;
    double ta = -1, ti = inf;
    for (i = 0; i < n; i++) {
        if (e[i].v == 0 && e[i].l > x) return false;
        maxx = max(maxx, e[i].l);
        minn = min(minn, e[i].l);
        if (maxx > x) break;
        last = maxx;
    }
    maxx = -1, minn = inf;
    //cout << 1 << " " << i << " " << last << endl;
 
    double now;
    for (; i < n; i++) {
        if (e[i].v == 0 && e[i].l > x) return false;
        maxx = max(maxx, e[i].l);
        minn = min(minn, e[i].l);
        if (minn + x <= last && maxx - x <= last) break;
 
        if ((maxx - minn) / 2 > x) break;
        now = (maxx + minn) / 2;
    }
    last = now;
    maxx = -1, minn = inf;
    //cout << 2 << " " << i << " " << last << endl;
    for (; i < n; i++) {
        if (e[i].v == 0 && e[i].l > x) return false;
        maxx = max(maxx, e[i].l);
        minn = min(minn, e[i].l);
        if (minn + x <= last && maxx - x <= last) break;
        if ((maxx - minn) / 2 > x) break;
    }
//    cout << 3 << " " << i << " " << last << endl;
//    cout << "i " << i << " n " << n << endl;
//    cout << endl;
    return i == n;
}
 
int main() {
    //freopen("input.txt", "r", stdin);
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lf %lf", &e[i].v, &e[i].l);
    }
 
    sort(e, e + n, cmp);
//    for (int i = 0; i < n; i++)
//        cout << e[i].v << " " << e[i].l << endl;
    double l = 0, r = 2e9, mid;
    while (r - l > 0.01) {
        mid = (l + r) / 2;
        if (check(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }
    printf("%.1f\n", r);
    return 0;
}

 

posted @ 2019-04-07 17:04 Albert_liu 阅读( ...) 评论( ...) 编辑 收藏
内容概要:该研究通过在黑龙江省某示范村进行24小时实地测试,比较了燃煤炉具与自动/手动进料生物质炉具的污染物排放特征。结果显示,生物质炉具相比燃煤炉具显著降低了PM2.5、CO和SO2的排放(自动进料分别降低41.2%、54.3%、40.0%;手动进料降低35.3%、22.1%、20.0%),但NOx排放未降低甚至有所增加。研究还发现,经济性和便利性是影响生物质炉具推广的重要因素。该研究不仅提供了实际排放数据支持,还通过Python代码详细复现了排放特征比较、减排效果计算和结果可视化,进一步探讨了燃料性质、动态排放特征、碳平衡计算以及政策建议。 适合人群:从事环境科学研究的学者、政府环保部门工作人员、能源政策制定者、关注农村能源转型的社会人士。 使用场景及目标:①评估生物质炉具在农村地区的推广潜力;②为政策制定者提供科学依据,优化补贴政策;③帮助研究人员深入了解生物质炉具的排放特征和技术改进方向;④为企业研发更高效的生物质炉具提供参考。 其他说明:该研究通过大量数据分析和模拟,揭示了生物质炉具在实际应用中的优点和挑战,特别是NOx排放增加的问题。研究还提出了多项具体的技术改进方向和政策建议,如优化进料方式、提高热效率、建设本地颗粒厂等,为生物质炉具的广泛推广提供了可行路径。此外,研究还开发了一个智能政策建议生成系统,可以根据不同地区的特征定制化生成政策建议,为农村能源转型提供了有力支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值