惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
O
OpenAI News
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
L
LINUX DO - 热门话题
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
Security Latest
Security Latest
S
SegmentFault 最新的问题
Project Zero
Project Zero
Spread Privacy
Spread Privacy
K
Kaspersky official blog
J
Java Code Geeks
V
Vulnerabilities – Threatpost
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
WordPress大学
WordPress大学
量子位
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
S
Secure Thoughts
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
Visual Studio Blog
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
腾讯CDC
Cyberwarzone
Cyberwarzone
IT之家
IT之家
GbyAI
GbyAI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
云风的 BLOG
云风的 BLOG
T
Troy Hunt's Blog
D
Docker

博客园 - Jeff

4个月 C++ 有限状态机 POJ1019 POJ1035 POJ1007 POJ1005 Linux shell定时器 怪异的grep结果 URL2FILE C primer笔记 Vxworks增加system call C语言常用宏定义技巧 分苹果 Socket 为什么选择SMP而不是AMP RTP memory in Vxworks Windriver的项目类型 RTP affinity Symmetric multiprocessing (SMP)
ONLINE_JUDGE
Jeff · 2012-01-04 · via 博客园 - Jeff

2012-01-04 17:07  Jeff  阅读(1281)  评论(0)    收藏  举报

POJ上已经定义了ONLINE_JUDGE. 所以要用"ifndef", 本地IDE中的宏定义删了. scanf: %f小数点后6位 %G和%g 小数点后2位,但是自动会去除末尾的0

 
#include "stdio.h"

int main(void) {
    float c;
    float result=0.0;
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    #else
    #endif
    while((scanf("%G",&c))!=EOF){
          //printf("%Gn",c);
         result = result + c;
         //printf("%Gn",result);
    }

    printf("$%G",result/12);
    #ifndef ONLINE_JUDGE
    fclose(stdin);
    #else
    #endif
    return 0;
}