VOTING POWER100.00%
DOWNVOTE POWER100.00%
RESOURCE CREDITS100.00%
REPUTATION PROGRESS58.81%
Net Worth
1.980USD
STEEM
0.001STEEM
SBD
3.944SBD
Effective Power
5.001SP
├── Own SP
0.635SP
└── Incoming DelegationsDeleg
+4.367SP
Detailed Balance
| STEEM | ||
| balance | 0.000STEEM | STEEM |
| market_balance | 0.000STEEM | STEEM |
| savings_balance | 0.000STEEM | STEEM |
| reward_steem_balance | 0.001STEEM | STEEM |
| STEEM POWER | ||
| Own SP | 0.635SP | SP |
| Delegated Out | 0.000SP | SP |
| Delegation In | 4.367SP | SP |
| Effective Power | 5.001SP | SP |
| Reward SP (pending) | 3.145SP | SP |
| SBD | ||
| sbd_balance | 1.000SBD | SBD |
| sbd_conversions | 0.000SBD | SBD |
| sbd_market_balance | 0.000SBD | SBD |
| savings_sbd_balance | 0.000SBD | SBD |
| reward_sbd_balance | 2.944SBD | SBD |
{
"balance": "0.000 STEEM",
"savings_balance": "0.000 STEEM",
"reward_steem_balance": "0.001 STEEM",
"vesting_shares": "1033.240259 VESTS",
"delegated_vesting_shares": "0.000000 VESTS",
"received_vesting_shares": "7110.419547 VESTS",
"sbd_balance": "1.000 SBD",
"savings_sbd_balance": "0.000 SBD",
"reward_sbd_balance": "2.944 SBD",
"conversions": []
}Account Info
| name | spearous |
| id | 275017 |
| rank | 1,427,887 |
| reputation | 53952968945 |
| created | 2017-07-22T09:07:48 |
| recovery_account | steem |
| proxy | None |
| post_count | 30 |
| comment_count | 0 |
| lifetime_vote_count | 0 |
| witnesses_voted_for | 0 |
| last_post | 2018-07-29T15:38:00 |
| last_root_post | 2018-07-29T15:38:00 |
| last_vote_time | 1970-01-01T00:00:00 |
| proxied_vsf_votes | 0, 0, 0, 0 |
| can_vote | 1 |
| voting_power | 0 |
| delayed_votes | 0 |
| balance | 0.000 STEEM |
| savings_balance | 0.000 STEEM |
| sbd_balance | 1.000 SBD |
| savings_sbd_balance | 0.000 SBD |
| vesting_shares | 1033.240259 VESTS |
| delegated_vesting_shares | 0.000000 VESTS |
| received_vesting_shares | 7110.419547 VESTS |
| reward_vesting_balance | 6460.322333 VESTS |
| vesting_balance | 0.000 STEEM |
| vesting_withdraw_rate | 0.000000 VESTS |
| next_vesting_withdrawal | 1969-12-31T23:59:59 |
| withdrawn | 0 |
| to_withdraw | 0 |
| withdraw_routes | 0 |
| savings_withdraw_requests | 0 |
| last_account_recovery | 1970-01-01T00:00:00 |
| reset_account | null |
| last_owner_update | 1970-01-01T00:00:00 |
| last_account_update | 1970-01-01T00:00:00 |
| mined | No |
| sbd_seconds | 0 |
| sbd_last_interest_payment | 1970-01-01T00:00:00 |
| savings_sbd_last_interest_payment | 1970-01-01T00:00:00 |
{
"id": 275017,
"name": "spearous",
"owner": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5y6db2uXx1myvFcPct7u2cLZQUXCUqBboyKQuVQpFJDEhiapB3",
1
]
]
},
"active": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM7JWKsQN1P8pQWqETmvGJBxkMHCegFTsr5s5AhmpAo6vyLHpgqo",
1
]
]
},
"posting": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5pSxHFF6XAAiLD6gG6tHFgkGudtZwsH1ZZa4cFHMoEGM6DzWfB",
1
]
]
},
"memo_key": "STM5472ugYPvsya3ZfV9brFUu7uop8SMNJ5hyKuF7f5iuN8R77xBW",
"json_metadata": "",
"posting_json_metadata": "",
"proxy": "",
"last_owner_update": "1970-01-01T00:00:00",
"last_account_update": "1970-01-01T00:00:00",
"created": "2017-07-22T09:07:48",
"mined": false,
"recovery_account": "steem",
"last_account_recovery": "1970-01-01T00:00:00",
"reset_account": "null",
"comment_count": 0,
"lifetime_vote_count": 0,
"post_count": 30,
"can_vote": true,
"voting_manabar": {
"current_mana": "8143659806",
"last_update_time": 1779086835
},
"downvote_manabar": {
"current_mana": 2035914951,
"last_update_time": 1779086835
},
"voting_power": 0,
"balance": "0.000 STEEM",
"savings_balance": "0.000 STEEM",
"sbd_balance": "1.000 SBD",
"sbd_seconds": "0",
"sbd_seconds_last_update": "2017-11-05T09:49:15",
"sbd_last_interest_payment": "1970-01-01T00:00:00",
"savings_sbd_balance": "0.000 SBD",
"savings_sbd_seconds": "0",
"savings_sbd_seconds_last_update": "1970-01-01T00:00:00",
"savings_sbd_last_interest_payment": "1970-01-01T00:00:00",
"savings_withdraw_requests": 0,
"reward_sbd_balance": "2.944 SBD",
"reward_steem_balance": "0.001 STEEM",
"reward_vesting_balance": "6460.322333 VESTS",
"reward_vesting_steem": "3.145 STEEM",
"vesting_shares": "1033.240259 VESTS",
"delegated_vesting_shares": "0.000000 VESTS",
"received_vesting_shares": "7110.419547 VESTS",
"vesting_withdraw_rate": "0.000000 VESTS",
"next_vesting_withdrawal": "1969-12-31T23:59:59",
"withdrawn": 0,
"to_withdraw": 0,
"withdraw_routes": 0,
"curation_rewards": 0,
"posting_rewards": 6289,
"proxied_vsf_votes": [
0,
0,
0,
0
],
"witnesses_voted_for": 0,
"last_post": "2018-07-29T15:38:00",
"last_root_post": "2018-07-29T15:38:00",
"last_vote_time": "1970-01-01T00:00:00",
"post_bandwidth": 0,
"pending_claimed_accounts": 0,
"vesting_balance": "0.000 STEEM",
"reputation": "53952968945",
"transfer_history": [],
"market_history": [],
"post_history": [],
"vote_history": [],
"other_history": [],
"witness_votes": [],
"tags_usage": [],
"guest_bloggers": [],
"rank": 1427887
}Withdraw Routes
| Incoming | Outgoing |
|---|---|
Empty | Empty |
{
"incoming": [],
"outgoing": []
}From Date
To Date
2026/05/18 06:47:15
2026/05/18 06:47:15
| delegator | steem |
| delegatee | spearous |
| vesting shares | 7110.419547 VESTS |
| Transaction Info | Block #106151256/Trx 2df47621034efff89ca48facd7d0465eba5937ed |
View Raw JSON Data
{
"trx_id": "2df47621034efff89ca48facd7d0465eba5937ed",
"block": 106151256,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-05-18T06:47:15",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "7110.419547 VESTS"
}
]
}2026/05/13 06:25:27
2026/05/13 06:25:27
| delegator | steem |
| delegatee | spearous |
| vesting shares | 4398.209142 VESTS |
| Transaction Info | Block #106007537/Trx 79b60b4b5350c92aba31df8f15fc6eb23dbdf68a |
View Raw JSON Data
{
"trx_id": "79b60b4b5350c92aba31df8f15fc6eb23dbdf68a",
"block": 106007537,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-05-13T06:25:27",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "4398.209142 VESTS"
}
]
}2026/04/26 05:58:15
2026/04/26 05:58:15
| delegator | steem |
| delegatee | spearous |
| vesting shares | 7122.935303 VESTS |
| Transaction Info | Block #105518725/Trx 45f9cef9d9472c831d94e45eecd7530d67c9bc0f |
View Raw JSON Data
{
"trx_id": "45f9cef9d9472c831d94e45eecd7530d67c9bc0f",
"block": 105518725,
"trx_in_block": 1,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-04-26T05:58:15",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "7122.935303 VESTS"
}
]
}2026/01/24 01:24:21
2026/01/24 01:24:21
| delegator | steem |
| delegatee | spearous |
| vesting shares | 4439.755961 VESTS |
| Transaction Info | Block #102872898/Trx 600aa37b88b5eacefb0055d6ea277ea77e1892f8 |
View Raw JSON Data
{
"trx_id": "600aa37b88b5eacefb0055d6ea277ea77e1892f8",
"block": 102872898,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2026-01-24T01:24:21",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "4439.755961 VESTS"
}
]
}2024/12/17 20:33:54
2024/12/17 20:33:54
| delegator | steem |
| delegatee | spearous |
| vesting shares | 4603.975158 VESTS |
| Transaction Info | Block #91319105/Trx 7d283364124173addf117a8b92a4222945f73456 |
View Raw JSON Data
{
"trx_id": "7d283364124173addf117a8b92a4222945f73456",
"block": 91319105,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2024-12-17T20:33:54",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "4603.975158 VESTS"
}
]
}2023/11/14 12:14:18
2023/11/14 12:14:18
| delegator | steem |
| delegatee | spearous |
| vesting shares | 4773.108690 VESTS |
| Transaction Info | Block #79873234/Trx 65c5f55a361a3ed7861599b5f8870317f9627cba |
View Raw JSON Data
{
"trx_id": "65c5f55a361a3ed7861599b5f8870317f9627cba",
"block": 79873234,
"trx_in_block": 6,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2023-11-14T12:14:18",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "4773.108690 VESTS"
}
]
}2023/09/22 10:59:36
2023/09/22 10:59:36
| delegator | steem |
| delegatee | spearous |
| vesting shares | 7710.017476 VESTS |
| Transaction Info | Block #78363585/Trx 66931007b5ff8abee63728d0bd1876cd6c66fcf7 |
View Raw JSON Data
{
"trx_id": "66931007b5ff8abee63728d0bd1876cd6c66fcf7",
"block": 78363585,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2023-09-22T10:59:36",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "7710.017476 VESTS"
}
]
}2022/11/03 18:22:36
2022/11/03 18:22:36
| delegator | steem |
| delegatee | spearous |
| vesting shares | 7932.068914 VESTS |
| Transaction Info | Block #69121231/Trx c3a44db76cd87427e28dad92a1ab6df577880db0 |
View Raw JSON Data
{
"trx_id": "c3a44db76cd87427e28dad92a1ab6df577880db0",
"block": 69121231,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2022-11-03T18:22:36",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "7932.068914 VESTS"
}
]
}2022/01/17 23:31:24
2022/01/17 23:31:24
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8152.176515 VESTS |
| Transaction Info | Block #60824420/Trx 8f0a9977c73dc08ee8c79d4a885d074ab498d225 |
View Raw JSON Data
{
"trx_id": "8f0a9977c73dc08ee8c79d4a885d074ab498d225",
"block": 60824420,
"trx_in_block": 37,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2022-01-17T23:31:24",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8152.176515 VESTS"
}
]
}2021/06/14 06:40:51
2021/06/14 06:40:51
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8336.370803 VESTS |
| Transaction Info | Block #54614714/Trx 7780b7547be8e5b6d0a6f33119236dc2d7cf0ce7 |
View Raw JSON Data
{
"trx_id": "7780b7547be8e5b6d0a6f33119236dc2d7cf0ce7",
"block": 54614714,
"trx_in_block": 7,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2021-06-14T06:40:51",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8336.370803 VESTS"
}
]
}2020/12/11 16:52:39
2020/12/11 16:52:39
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8523.792777 VESTS |
| Transaction Info | Block #49361961/Trx c0b2bdf6e57c2d9f20ddb275a07fbdadbbad2c77 |
View Raw JSON Data
{
"trx_id": "c0b2bdf6e57c2d9f20ddb275a07fbdadbbad2c77",
"block": 49361961,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-11T16:52:39",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8523.792777 VESTS"
}
]
}2020/12/06 10:28:06
2020/12/06 10:28:06
| delegator | steem |
| delegatee | spearous |
| vesting shares | 1912.543513 VESTS |
| Transaction Info | Block #49213475/Trx 8b379241e458fad38b37c397ed7dea63a1b15dfe |
View Raw JSON Data
{
"trx_id": "8b379241e458fad38b37c397ed7dea63a1b15dfe",
"block": 49213475,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-06T10:28:06",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "1912.543513 VESTS"
}
]
}2020/12/05 20:30:33
2020/12/05 20:30:33
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8530.000631 VESTS |
| Transaction Info | Block #49197048/Trx d17dd635ee1df8f66562907f7fc0f1978f527b4e |
View Raw JSON Data
{
"trx_id": "d17dd635ee1df8f66562907f7fc0f1978f527b4e",
"block": 49197048,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-12-05T20:30:33",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8530.000631 VESTS"
}
]
}2020/11/03 03:37:51
2020/11/03 03:37:51
| delegator | steem |
| delegatee | spearous |
| vesting shares | 1920.017158 VESTS |
| Transaction Info | Block #48271918/Trx 9fce2b7800c11446d6f1aaedd4636fec9bc85fe9 |
View Raw JSON Data
{
"trx_id": "9fce2b7800c11446d6f1aaedd4636fec9bc85fe9",
"block": 48271918,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-11-03T03:37:51",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "1920.017158 VESTS"
}
]
}2020/05/09 11:31:45
2020/05/09 11:31:45
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8732.805990 VESTS |
| Transaction Info | Block #43223814/Trx 2443ebb26611280a1f39a75f96c50ff3ed72daa1 |
View Raw JSON Data
{
"trx_id": "2443ebb26611280a1f39a75f96c50ff3ed72daa1",
"block": 43223814,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-05-09T11:31:45",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8732.805990 VESTS"
}
]
}2020/05/08 15:59:45
2020/05/08 15:59:45
| delegator | steem |
| delegatee | spearous |
| vesting shares | 1953.311140 VESTS |
| Transaction Info | Block #43200932/Trx 3f9105043475c341252b3597aff9dbc99108d7b0 |
View Raw JSON Data
{
"trx_id": "3f9105043475c341252b3597aff9dbc99108d7b0",
"block": 43200932,
"trx_in_block": 17,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2020-05-08T15:59:45",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "1953.311140 VESTS"
}
]
}antparadisereplied to @spearous / q255962019/12/07 11:58:21
antparadisereplied to @spearous / q25596
2019/12/07 11:58:21
| parent author | spearous |
| parent permlink | 2h46y |
| author | antparadise |
| permlink | q25596 |
| title | |
| body | 红色和绿色那个是点赞啊? |
| json metadata | {"app":"steemit/0.1"} |
| Transaction Info | Block #38827979/Trx 35cb1d7653735f961148ca7dc3eeb40c02f824e3 |
View Raw JSON Data
{
"trx_id": "35cb1d7653735f961148ca7dc3eeb40c02f824e3",
"block": 38827979,
"trx_in_block": 15,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-12-07T11:58:21",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "2h46y",
"author": "antparadise",
"permlink": "q25596",
"title": "",
"body": "红色和绿色那个是点赞啊?",
"json_metadata": "{\"app\":\"steemit/0.1\"}"
}
]
}2019/11/01 09:37:09
2019/11/01 09:37:09
| delegator | steem |
| delegatee | spearous |
| vesting shares | 8839.205073 VESTS |
| Transaction Info | Block #37790321/Trx 3f3298881178ab548e518c11deea726d2ee9586b |
View Raw JSON Data
{
"trx_id": "3f3298881178ab548e518c11deea726d2ee9586b",
"block": 37790321,
"trx_in_block": 24,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-11-01T09:37:09",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "8839.205073 VESTS"
}
]
}2019/07/22 10:15:51
2019/07/22 10:15:51
| parent author | spearous |
| parent permlink | python-3-snippets-basic-i-o |
| author | steemitboard |
| permlink | steemitboard-notify-spearous-20190722t101551000z |
| title | |
| body | Congratulations @spearous! You received a personal award! <table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@spearous/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table> <sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@spearous) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=spearous)_</sub> ###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes! |
| json metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
| Transaction Info | Block #34882286/Trx a2a856ceea2aaa8047782ab77bf397420e35de4b |
View Raw JSON Data
{
"trx_id": "a2a856ceea2aaa8047782ab77bf397420e35de4b",
"block": 34882286,
"trx_in_block": 3,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2019-07-22T10:15:51",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "python-3-snippets-basic-i-o",
"author": "steemitboard",
"permlink": "steemitboard-notify-spearous-20190722t101551000z",
"title": "",
"body": "Congratulations @spearous! You received a personal award!\n\n<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@spearous/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>\n\n<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@spearous) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=spearous)_</sub>\n\n\n###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!",
"json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}"
}
]
}2018/11/26 19:33:42
2018/11/26 19:33:42
| delegator | steem |
| delegatee | spearous |
| vesting shares | 9036.680450 VESTS |
| Transaction Info | Block #28046415/Trx 7189f2c971943acc3cc2fab3260a2fe68471729a |
View Raw JSON Data
{
"trx_id": "7189f2c971943acc3cc2fab3260a2fe68471729a",
"block": 28046415,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-11-26T19:33:42",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "9036.680450 VESTS"
}
]
}2018/10/08 19:05:57
2018/10/08 19:05:57
| delegator | steem |
| delegatee | spearous |
| vesting shares | 29256.804513 VESTS |
| Transaction Info | Block #26635642/Trx a49eadc33607bfdb1a8334b0c6a75133145f8e39 |
View Raw JSON Data
{
"trx_id": "a49eadc33607bfdb1a8334b0c6a75133145f8e39",
"block": 26635642,
"trx_in_block": 48,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-10-08T19:05:57",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "29256.804513 VESTS"
}
]
}spearouspublished a new post: python-3-snippets-basic-i-o2018/07/29 15:38:00
spearouspublished a new post: python-3-snippets-basic-i-o
2018/07/29 15:38:00
| parent author | |
| parent permlink | python |
| author | spearous |
| permlink | python-3-snippets-basic-i-o |
| title | python 3 snippets: basic I/O |
| body | ## Intro Here I summarize the basic I/O snippet in python 3, so to be used later. A major difference is raw_input() is removed in python3 and there is some change in print() function as well. ## input() The basic input() to get an integer input looks like this: ``` list_of_input = int(input("please give an integer:")) ``` SInce the default type python gets from the input is a string, we should use int() to convert it into the desired data type. Now we shall assemble out some snippets to tackle more sophisticated input. - several integers input in a line and are separated by spaces example input: 1 2 3 4 ``` print ("Type integers in one line, separated by a space:\n") while True: try: list_of_input = map(lambda x:int(x), input().split()) # or convert it into a list # list_of_input = list(map(lambda x:int(x), input().split())) # or put directly into a list # list_of_input = [a[0] for a in input().split()] except ValueError as err: print(err) continue except EOFError: # print("End of input") # break continue ``` - several integers in several lines and are each followed by EOF: example input 1 2 3 4 ``` import sys while True: try: list_of_input = list(x[0] for x in sys.stdin) except ValueError as err: print(err) continue except EOFError: # print("End of input") # break continue ``` - to decide an input character is a letter or a number: if it is a number then return the number in int type, if it is a letter, return the letter in string type. ``` def return_char_in_int_or_string(x): if (ord(x)<90): return(ord(x)) return(x) ``` ## print() Usually, print() is pretty straightforward. The only difference with python 2.x is now print needs "()" to include the content. ``` print("number1= %d , number2=%d" % (number1, number2) ) ``` The prototype of print() in python 3.x is: ``` print(*objects, sep=’ ‘, end=’\n’, file=sys.stdout, flush=False) ``` so to output without a newline, one could do: ``` print("*",end="") ``` to specify the ending character (the above example is null, which means no newline after the output) However, in python 2.x, the old trick was: ``` print x, ``` No newline will be created due to the extra "," at the end. However, there will be an extra space at the end of the output though. |
| json metadata | {"tags":["python","python3","acm","basic","snippets"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #24603459/Trx 03fd4e5a64fd177ee83a59ded0d5bf4c8bde5f71 |
View Raw JSON Data
{
"trx_id": "03fd4e5a64fd177ee83a59ded0d5bf4c8bde5f71",
"block": 24603459,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-07-29T15:38:00",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "python",
"author": "spearous",
"permlink": "python-3-snippets-basic-i-o",
"title": "python 3 snippets: basic I/O",
"body": "## Intro\n\nHere I summarize the basic I/O snippet in python 3, so to be used later. A major difference is raw_input() is removed in python3 and there is some change in print() function as well.\n\n## input()\n \nThe basic input() to get an integer input looks like this:\n```\nlist_of_input = int(input(\"please give an integer:\"))\n```\nSInce the default type python gets from the input is a string, we should use int() to convert it into the desired data type. Now we shall assemble out some snippets to tackle more sophisticated input.\n\n\n- several integers input in a line and are separated by spaces\nexample input: \n\n1 2 3 4\n\n```\nprint (\"Type integers in one line, separated by a space:\\n\")\n\nwhile True:\n try:\n list_of_input = map(lambda x:int(x), input().split()) \n\n# or convert it into a list \n# list_of_input = list(map(lambda x:int(x), input().split()))\n\n# or put directly into a list\n# list_of_input = [a[0] for a in input().split()]\n\n except ValueError as err:\n print(err)\n continue\n except EOFError:\n# print(\"End of input\")\n# break\n continue\n```\n\n- several integers in several lines and are each followed by EOF:\n\nexample input\n\n1\n2\n3\n4\n\n```\nimport sys\nwhile True:\n try:\n list_of_input = list(x[0] for x in sys.stdin)\n\n except ValueError as err:\n print(err)\n continue\n except EOFError:\n# print(\"End of input\")\n# break\n continue\n```\n\n- to decide an input character is a letter or a number: if it is a number then return the number in int type, if it is a letter, return the letter in string type.\n\n```\ndef return_char_in_int_or_string(x):\n if (ord(x)<90):\n return(ord(x))\n return(x)\n```\n\n\n## print()\nUsually, print() is pretty straightforward. The only difference with python 2.x is now print needs \"()\" to include the content. \n```\nprint(\"number1= %d , number2=%d\" % (number1, number2) )\n```\n\n\nThe prototype of print() in python 3.x is:\n```\nprint(*objects, sep=’ ‘, end=’\\n’, file=sys.stdout, flush=False)\n```\n\nso to output without a newline, one could do:\n```\nprint(\"*\",end=\"\")\n```\nto specify the ending character (the above example is null, which means no newline after the output)\n\nHowever, in python 2.x, the old trick was:\n```\nprint x,\n```\nNo newline will be created due to the extra \",\" at the end. However, there will be an extra space at the end of the output though.",
"json_metadata": "{\"tags\":[\"python\",\"python3\",\"acm\",\"basic\",\"snippets\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}2018/07/22 11:30:15
2018/07/22 11:30:15
| parent author | spearous |
| parent permlink | 1 |
| author | steemitboard |
| permlink | steemitboard-notify-spearous-20180722t113015000z |
| title | |
| body | Congratulations @spearous! You have received a personal award! [](http://steemitboard.com/@spearous) 1 Year on Steemit <sub>_Click on the badge to view your Board of Honor._</sub> **Do not miss the last post from @steemitboard:** [SteemitBoard World Cup Contest - The results, the winners and the prizes](https://steemit.com/steemitboard/@steemitboard/steemitboard-world-cup-contest-the-results-and-prizes) > Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**! |
| json metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
| Transaction Info | Block #24397474/Trx 7318f94bcba826821259d5849fdb9a390030dd15 |
View Raw JSON Data
{
"trx_id": "7318f94bcba826821259d5849fdb9a390030dd15",
"block": 24397474,
"trx_in_block": 10,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-07-22T11:30:15",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "1",
"author": "steemitboard",
"permlink": "steemitboard-notify-spearous-20180722t113015000z",
"title": "",
"body": "Congratulations @spearous! You have received a personal award!\n\n[](http://steemitboard.com/@spearous) 1 Year on Steemit\n<sub>_Click on the badge to view your Board of Honor._</sub>\n\n\n**Do not miss the last post from @steemitboard:**\n[SteemitBoard World Cup Contest - The results, the winners and the prizes](https://steemit.com/steemitboard/@steemitboard/steemitboard-world-cup-contest-the-results-and-prizes)\n\n> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!",
"json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}"
}
]
}2018/06/04 19:51:51
2018/06/04 19:51:51
| author | spearous |
| permlink | 1 |
| sbd payout | 0.007 SBD |
| steem payout | 0.001 STEEM |
| vesting payout | 10.164215 VESTS |
| Transaction Info | Block #23036042/Virtual Operation #2 |
View Raw JSON Data
{
"trx_id": "0000000000000000000000000000000000000000",
"block": 23036042,
"trx_in_block": 4294967295,
"op_in_trx": 0,
"virtual_op": 2,
"timestamp": "2018-06-04T19:51:51",
"op": [
"author_reward",
{
"author": "spearous",
"permlink": "1",
"sbd_payout": "0.007 SBD",
"steem_payout": "0.001 STEEM",
"vesting_payout": "10.164215 VESTS"
}
]
}toronsteemupvoted (10.00%) @spearous / 12018/06/03 18:21:03
toronsteemupvoted (10.00%) @spearous / 1
2018/06/03 18:21:03
| voter | toronsteem |
| author | spearous |
| permlink | 1 |
| weight | 1000 (10.00%) |
| Transaction Info | Block #23005440/Trx 03995ea6054d7f71a6a40462b6df9d3c6a421bb8 |
View Raw JSON Data
{
"trx_id": "03995ea6054d7f71a6a40462b6df9d3c6a421bb8",
"block": 23005440,
"trx_in_block": 8,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-06-03T18:21:03",
"op": [
"vote",
{
"voter": "toronsteem",
"author": "spearous",
"permlink": "1",
"weight": 1000
}
]
}2018/06/03 18:20:57
2018/06/03 18:20:57
| voter | marystone |
| author | spearous |
| permlink | 1 |
| weight | 2000 (20.00%) |
| Transaction Info | Block #23005438/Trx 85b610ad317611c5042920bb9848d63696fd0f8f |
View Raw JSON Data
{
"trx_id": "85b610ad317611c5042920bb9848d63696fd0f8f",
"block": 23005438,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-06-03T18:20:57",
"op": [
"vote",
{
"voter": "marystone",
"author": "spearous",
"permlink": "1",
"weight": 2000
}
]
}2018/05/28 20:10:54
2018/05/28 20:10:54
| voter | swagger |
| author | spearous |
| permlink | 1 |
| weight | 3 (0.03%) |
| Transaction Info | Block #22834887/Trx 07b308aa91f9e9fe634080883601d25df4b002b2 |
View Raw JSON Data
{
"trx_id": "07b308aa91f9e9fe634080883601d25df4b002b2",
"block": 22834887,
"trx_in_block": 0,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T20:10:54",
"op": [
"vote",
{
"voter": "swagger",
"author": "spearous",
"permlink": "1",
"weight": 3
}
]
}spearousfollowed @cn-cutie.pie2018/05/28 19:59:30
spearousfollowed @cn-cutie.pie
2018/05/28 19:59:30
| required auths | [] |
| required posting auths | ["spearous"] |
| id | follow |
| json | ["follow",{"follower":"spearous","following":"cn-cutie.pie","what":["blog"]}] |
| Transaction Info | Block #22834659/Trx 0b9f16296c91d1099fb365b68f15160c9d6c1e33 |
View Raw JSON Data
{
"trx_id": "0b9f16296c91d1099fb365b68f15160c9d6c1e33",
"block": 22834659,
"trx_in_block": 68,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T19:59:30",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"spearous"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"spearous\",\"following\":\"cn-cutie.pie\",\"what\":[\"blog\"]}]"
}
]
}2018/05/28 19:59:21
2018/05/28 19:59:21
| parent author | |
| parent permlink | cn |
| author | spearous |
| permlink | 1 |
| title | 1岁小孩要不要吃全脂牛奶(一) |
| body | 在网上看了一下,竟然有两种截然相反的看法。国内的主流看法是不要加;国外的主流看法,包括欧美澳,都是1岁开始加。 这个问题,看似表述清晰,但根据网上很多人的理解,还是模糊之处。问题集中在: 1 全脂牛奶有什么好处?国内和国外的看法不同的原因是什么?是有各自的前提,所以结论不同,还是说一方是对的,另一方是错的? 2 吃全脂牛奶,是不是意味着就要把奶粉断了? 3 如果有其他食物和全脂牛奶一起吃,那么有什么禁忌? 4 既然吃全脂牛奶,那么量的上限是多少? 5 既然开始吃全脂牛奶,那什么时候停还是一直吃下去? 6 如果碰到过敏的孩子,会有什么症状;或者说怎么知道小孩是不是对全脂牛奶过敏? 我并非专家,但想到这些问题是可能不止我会关心,而是每个家长都会在意。所以,在这集中收集一些网上的资料,并且给出我自己的想法给大家参考: ==================================================================================== # 1和2 全脂牛奶有什么好处?吃全脂牛奶,是不是意味着就要把奶粉断了? 首先,全脂牛奶的好处肯定是有额外的营养。但究竟有什么利弊呢?这里放几张营养表格(数据来源:美国食品卫生管理局USDA),当然实际含量根据奶源也是有不同的。   全脂奶的营养主要包括蛋白质,脂肪和脂溶性物质(包括胆固醇,维生素A, D, E和类胡萝卜素),其他维生素(B族维生素),乳糖,微量元素和矿物质(钾,钙,钠,铁等) 脱脂奶和全脂奶的营养差别,主要在失去了脂肪和脂溶性物质,其他都是类似的。低脂奶的脂肪和脂溶性物质在全脂和脱脂之间。 配方奶根据品牌不同,所含营养也有区别,这里放的是美赞臣美国市场版本的两种,toddler premium(上图,1-3岁)和toddler transition(下图9-18个月):   结论: 脱脂奶缺乏必要的脂溶性维生素,因此就不推荐了。以下就比较全脂牛奶和配方奶。 而如果将配方奶和全脂牛奶比较,很容看出,糖含量是很不同的。因为这里比较的是沏好的奶粉的量,所以是100mL对比全脂奶的100g。表格里显示,全脂奶100g是4.8g糖,而premium toddler 100mL是8.5g糖,多了一倍。我个人还是倾向于糖含量比较少的。所以就此而言,全脂奶是优于美赞臣配方奶的。 对于脂肪含量,因为在这个年龄的幼儿,神经和大脑发育需要脂肪,尤其是不饱和脂肪,因此这一项应该不低于3%。另外,可以注意到人类母乳里不饱和脂肪有2.2g,而全脂牛奶为1g左右也可以发现确实是不同动物的对生长的需求不一样啊。母乳对神经和大脑发育更好(如果看一下钙和维生素D的含量,就可以发现全脂牛奶含量尤其多,可能因为牛对骨骼发育的需求比人类大得多吧)配方奶的不饱和脂肪含量大约在1.6g左右,也是可以的。 对于微量元素,主要考察铁,钙和维生素D。首先,这个阶段的婴幼儿是需要这些铁,钙的,而维生素C有助于贴的吸收,维生素D对钙吸收极为重要。很奇怪,母乳里铁含量很低。这可能是因为在胎儿阶段已经在体内积累的足够的铁吧(https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH): 铁的推荐值为每日7mg (https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/) 维生素C为每日15mg (https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/) 钙为每日700mg (https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/) 维生素D推荐值为每天600IU(15mcg) (https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/) 和前面的营养表格对比,就发现不管是母乳还是全脂牛奶,铁和维生素C几乎没有。USDA的表格用的百分比,含义是可以提供每日推荐量的百分比。比如全脂牛奶的维生素D为12%,即100g全脂牛奶可以提供每日所需推荐量的12%(https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf) 所以,想达到维生素D和钙的每日推荐量,需要约1000g全脂牛奶。但是,下文会提到,全脂牛奶的每日饮用量,据美国儿童医学会旗下网站的数据,不应超过32盎司(约960mL或1quart)(https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx) 所以,纯靠全脂牛奶是不能实现这几种矿物质的补充的。而按照Enfamil的配方,可以算出,大约需要700mL即可满足以上四种营养物质的补充。但是,尽管配方奶在数字上够上标准了,但在营养物质的具体存在形式上,比如钙是以什么化合物存在于配方奶中的,我们都是不知道的。公认,牛奶中的钙是比较容易吸收的,而某些补钙剂用的是碳酸钙之类的无机钙,是不好吸收的。所以,以牛奶,豆奶的形式补充钙是很重要的。 所以,结论就是,为了补充脂肪尤其是不饱和脂肪的需要,也为了钙等容易吸收,应该加入全脂牛奶。但在加入全脂牛奶的同时,因为受限于每日不能超过32oz(960mL或1quart),我们必须同时加入配方奶,或者其他辅食,否则至少在铁、钙和维生素C、D上是稍微欠缺的。 最后,打算稍微讨论一下,国内和国外在这点上的区别。以下几种机构的说法: >>> 美国儿科协会AAP 当宝宝1岁之后,你可以给他全脂牛奶或者低脂(2%)牛奶,同固体辅食(麦片、蔬菜、水果、肉)一起提供均衡的饮食。但他一天最多喝1夸脱(约946毫升)牛奶。更多的奶会提供过多的热量,同时减少他对于其他食物的胃口。 >>> 世界卫生组织WHO 到1岁,大多数宝宝都可以和家庭其他成员吃一样的食物了。全脂牛奶在生命的头2年很重要。因为不含必需的脂肪酸、缺乏脂溶性维生素并且肾负荷较高,不推荐将脱脂牛奶作为2岁以内的儿童主要食物。低脂牛奶可以在12个月之后添加。 >>> 香港地区卫生署 一岁幼儿已能从多样化的饮食摄取所需的营养。家长需注意奶只是一岁或以上幼儿均衡饮食的一部分,亦是一种较易获取钙质的来源。……家长可让幼儿(指一岁后*OK妈注)饮用较配方奶便宜的牛奶(包括鲜牛奶、冷藏或保鲜装UHT牛奶、或全脂奶粉)。家长无须为幼儿转用成长或助长配方奶 (即「3」、 「4」号)摄取额外营养。 >>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐一 普通鲜奶、酸奶、奶酪等的蛋白质和矿物质含量远高于母乳,增加婴幼儿肾脏负担,对于12-24月龄幼儿可以将其作为食物多样化的一部分而逐渐尝试,但建议少量进食为宜,不能以此完全替代母乳或配方奶。 >>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐二 13~24个月龄幼儿的奶量应维持约500ml,每天1个鸡蛋加50-75g肉禽鱼,每天50~100g的谷物类,蔬菜、水果的量仍然以幼儿需要而定。不能母乳喂养或母乳喂养不足时,仍然建议以合适的幼儿配方奶作为补充,可引入少量鲜牛奶、酸奶、奶酪等,作为幼儿辅食的一部分。 可以看到国外基本都是推荐在1岁开始尝试全脂牛奶。而国内的建议,在膳食指南2016里建议引入少量鲜牛奶。我个人分析,这是因为膳食指南里,已经建议了谷物等其他食物,所以把鲜奶作为补充。众所周知,因为膳食结构的不同,亚洲人吃稻米比较多,吃奶制品少,因而很多人有乳糖不耐症而不能吃奶制品;而欧美人吃稻米少,吃奶制品多,因而很多人有麸质不耐受而不能吃稻米。排除了食物过敏的情况之后,食物不耐症,如乳糖不耐症主要是因为成年后喝奶少了,因此乳糖消化酶的表达量就低了,因此喝奶就无法分解其中的乳糖。然而,如果你持续喝奶很长一段时间,如3个月以上,你会发现你不再拉肚子,因为此时你的身体根据你的膳食结构重新调整了消化酶的表达量,你因此可以分解牛奶了。当然,有时候食物过敏也是类似的症状,这个通过持续喝奶是无法消除的。 因此,其实国内和国外的建议的分歧,其实是前提,也就是各自国家居民膳食结构的不同产生的。我们国家国内的人,成年之后基本是以稻米为主,因此1岁后给幼儿加入谷物,而此时加入全脂奶意义不大。国外的人因为依赖奶制品较多,所以1岁后加入全脂奶也是可以理解的。所以,如果是国外的话,完全可以慢慢以全脂奶为主,而如果是国内的话,以谷物为主就可以了,全脂奶应该作为营养补充来使用。 |
| json metadata | {"tags":["cn","cn-reader","baby","food","milk"],"image":["https://cdn.steemitimages.com/DQmadiu6uYAYKxBzNJGHjMK1jK6p4zFSGnbs3qRdMPJAoPX/nutrition%20facts%20100g%20whole%20milk.jpg","https://cdn.steemitimages.com/DQmczL54Db9QodUM62Ej7YByCv3uEqdgMVSdaCQqr2iy43S/nutrition%20facts%20100g%201percent%20milk.jpg","https://cdn.steemitimages.com/DQmbQUEzo9MYyBKYHhev71iofDAbAARejYV21FuZnZHyH59/nutrition%20facts%20100g%20enfamil%20toddler%20transition.jpg","https://cdn.steemitimages.com/DQmQCq9wFybtBvW36AR2wt2ZuhmhQhfT986qVdTxhmVSkFv/nutrition%20facts%20100g%20enfamil%20toddler%20premium.jpg"],"links":["https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):","https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)","https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)","https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)","https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/","https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)","https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #22834656/Trx c6f0aaf73643fda1065924aef26c9b371e8bc23f |
View Raw JSON Data
{
"trx_id": "c6f0aaf73643fda1065924aef26c9b371e8bc23f",
"block": 22834656,
"trx_in_block": 8,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T19:59:21",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "cn",
"author": "spearous",
"permlink": "1",
"title": "1岁小孩要不要吃全脂牛奶(一)",
"body": "在网上看了一下,竟然有两种截然相反的看法。国内的主流看法是不要加;国外的主流看法,包括欧美澳,都是1岁开始加。\n\n这个问题,看似表述清晰,但根据网上很多人的理解,还是模糊之处。问题集中在:\n\n1 全脂牛奶有什么好处?国内和国外的看法不同的原因是什么?是有各自的前提,所以结论不同,还是说一方是对的,另一方是错的?\n\n2 吃全脂牛奶,是不是意味着就要把奶粉断了?\n\n3 如果有其他食物和全脂牛奶一起吃,那么有什么禁忌?\n\n4 既然吃全脂牛奶,那么量的上限是多少?\n\n5 既然开始吃全脂牛奶,那什么时候停还是一直吃下去?\n\n6 如果碰到过敏的孩子,会有什么症状;或者说怎么知道小孩是不是对全脂牛奶过敏? \n\n\n我并非专家,但想到这些问题是可能不止我会关心,而是每个家长都会在意。所以,在这集中收集一些网上的资料,并且给出我自己的想法给大家参考:\n\n====================================================================================\n\n# 1和2 全脂牛奶有什么好处?吃全脂牛奶,是不是意味着就要把奶粉断了?\n\n首先,全脂牛奶的好处肯定是有额外的营养。但究竟有什么利弊呢?这里放几张营养表格(数据来源:美国食品卫生管理局USDA),当然实际含量根据奶源也是有不同的。\n\n\n\n\n\n\n全脂奶的营养主要包括蛋白质,脂肪和脂溶性物质(包括胆固醇,维生素A, D, E和类胡萝卜素),其他维生素(B族维生素),乳糖,微量元素和矿物质(钾,钙,钠,铁等)\n\n脱脂奶和全脂奶的营养差别,主要在失去了脂肪和脂溶性物质,其他都是类似的。低脂奶的脂肪和脂溶性物质在全脂和脱脂之间。\n\n配方奶根据品牌不同,所含营养也有区别,这里放的是美赞臣美国市场版本的两种,toddler premium(上图,1-3岁)和toddler transition(下图9-18个月):\n\n\n\n\n\n\n结论:\n脱脂奶缺乏必要的脂溶性维生素,因此就不推荐了。以下就比较全脂牛奶和配方奶。\n\n而如果将配方奶和全脂牛奶比较,很容看出,糖含量是很不同的。因为这里比较的是沏好的奶粉的量,所以是100mL对比全脂奶的100g。表格里显示,全脂奶100g是4.8g糖,而premium toddler 100mL是8.5g糖,多了一倍。我个人还是倾向于糖含量比较少的。所以就此而言,全脂奶是优于美赞臣配方奶的。\n\n对于脂肪含量,因为在这个年龄的幼儿,神经和大脑发育需要脂肪,尤其是不饱和脂肪,因此这一项应该不低于3%。另外,可以注意到人类母乳里不饱和脂肪有2.2g,而全脂牛奶为1g左右也可以发现确实是不同动物的对生长的需求不一样啊。母乳对神经和大脑发育更好(如果看一下钙和维生素D的含量,就可以发现全脂牛奶含量尤其多,可能因为牛对骨骼发育的需求比人类大得多吧)配方奶的不饱和脂肪含量大约在1.6g左右,也是可以的。\n\n对于微量元素,主要考察铁,钙和维生素D。首先,这个阶段的婴幼儿是需要这些铁,钙的,而维生素C有助于贴的吸收,维生素D对钙吸收极为重要。很奇怪,母乳里铁含量很低。这可能是因为在胎儿阶段已经在体内积累的足够的铁吧(https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):\n\n铁的推荐值为每日7mg (https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)\n\n维生素C为每日15mg (https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)\n\n钙为每日700mg (https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)\n\n维生素D推荐值为每天600IU(15mcg) (https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/)\n\n和前面的营养表格对比,就发现不管是母乳还是全脂牛奶,铁和维生素C几乎没有。USDA的表格用的百分比,含义是可以提供每日推荐量的百分比。比如全脂牛奶的维生素D为12%,即100g全脂牛奶可以提供每日所需推荐量的12%(https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)\n\n所以,想达到维生素D和钙的每日推荐量,需要约1000g全脂牛奶。但是,下文会提到,全脂牛奶的每日饮用量,据美国儿童医学会旗下网站的数据,不应超过32盎司(约960mL或1quart)(https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)\n\n所以,纯靠全脂牛奶是不能实现这几种矿物质的补充的。而按照Enfamil的配方,可以算出,大约需要700mL即可满足以上四种营养物质的补充。但是,尽管配方奶在数字上够上标准了,但在营养物质的具体存在形式上,比如钙是以什么化合物存在于配方奶中的,我们都是不知道的。公认,牛奶中的钙是比较容易吸收的,而某些补钙剂用的是碳酸钙之类的无机钙,是不好吸收的。所以,以牛奶,豆奶的形式补充钙是很重要的。\n\n所以,结论就是,为了补充脂肪尤其是不饱和脂肪的需要,也为了钙等容易吸收,应该加入全脂牛奶。但在加入全脂牛奶的同时,因为受限于每日不能超过32oz(960mL或1quart),我们必须同时加入配方奶,或者其他辅食,否则至少在铁、钙和维生素C、D上是稍微欠缺的。\n\n\n\n\n\n最后,打算稍微讨论一下,国内和国外在这点上的区别。以下几种机构的说法:\n\n>>> 美国儿科协会AAP\n\n当宝宝1岁之后,你可以给他全脂牛奶或者低脂(2%)牛奶,同固体辅食(麦片、蔬菜、水果、肉)一起提供均衡的饮食。但他一天最多喝1夸脱(约946毫升)牛奶。更多的奶会提供过多的热量,同时减少他对于其他食物的胃口。\n\n>>> 世界卫生组织WHO\n\n到1岁,大多数宝宝都可以和家庭其他成员吃一样的食物了。全脂牛奶在生命的头2年很重要。因为不含必需的脂肪酸、缺乏脂溶性维生素并且肾负荷较高,不推荐将脱脂牛奶作为2岁以内的儿童主要食物。低脂牛奶可以在12个月之后添加。\n\n>>> 香港地区卫生署\n\n一岁幼儿已能从多样化的饮食摄取所需的营养。家长需注意奶只是一岁或以上幼儿均衡饮食的一部分,亦是一种较易获取钙质的来源。……家长可让幼儿(指一岁后*OK妈注)饮用较配方奶便宜的牛奶(包括鲜牛奶、冷藏或保鲜装UHT牛奶、或全脂奶粉)。家长无须为幼儿转用成长或助长配方奶 (即「3」、 「4」号)摄取额外营养。\n\n>>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐一\n\n普通鲜奶、酸奶、奶酪等的蛋白质和矿物质含量远高于母乳,增加婴幼儿肾脏负担,对于12-24月龄幼儿可以将其作为食物多样化的一部分而逐渐尝试,但建议少量进食为宜,不能以此完全替代母乳或配方奶。\n\n>>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐二\n\n13~24个月龄幼儿的奶量应维持约500ml,每天1个鸡蛋加50-75g肉禽鱼,每天50~100g的谷物类,蔬菜、水果的量仍然以幼儿需要而定。不能母乳喂养或母乳喂养不足时,仍然建议以合适的幼儿配方奶作为补充,可引入少量鲜牛奶、酸奶、奶酪等,作为幼儿辅食的一部分。\n\n\n可以看到国外基本都是推荐在1岁开始尝试全脂牛奶。而国内的建议,在膳食指南2016里建议引入少量鲜牛奶。我个人分析,这是因为膳食指南里,已经建议了谷物等其他食物,所以把鲜奶作为补充。众所周知,因为膳食结构的不同,亚洲人吃稻米比较多,吃奶制品少,因而很多人有乳糖不耐症而不能吃奶制品;而欧美人吃稻米少,吃奶制品多,因而很多人有麸质不耐受而不能吃稻米。排除了食物过敏的情况之后,食物不耐症,如乳糖不耐症主要是因为成年后喝奶少了,因此乳糖消化酶的表达量就低了,因此喝奶就无法分解其中的乳糖。然而,如果你持续喝奶很长一段时间,如3个月以上,你会发现你不再拉肚子,因为此时你的身体根据你的膳食结构重新调整了消化酶的表达量,你因此可以分解牛奶了。当然,有时候食物过敏也是类似的症状,这个通过持续喝奶是无法消除的。\n\n因此,其实国内和国外的建议的分歧,其实是前提,也就是各自国家居民膳食结构的不同产生的。我们国家国内的人,成年之后基本是以稻米为主,因此1岁后给幼儿加入谷物,而此时加入全脂奶意义不大。国外的人因为依赖奶制品较多,所以1岁后加入全脂奶也是可以理解的。所以,如果是国外的话,完全可以慢慢以全脂奶为主,而如果是国内的话,以谷物为主就可以了,全脂奶应该作为营养补充来使用。",
"json_metadata": "{\"tags\":[\"cn\",\"cn-reader\",\"baby\",\"food\",\"milk\"],\"image\":[\"https://cdn.steemitimages.com/DQmadiu6uYAYKxBzNJGHjMK1jK6p4zFSGnbs3qRdMPJAoPX/nutrition%20facts%20100g%20whole%20milk.jpg\",\"https://cdn.steemitimages.com/DQmczL54Db9QodUM62Ej7YByCv3uEqdgMVSdaCQqr2iy43S/nutrition%20facts%20100g%201percent%20milk.jpg\",\"https://cdn.steemitimages.com/DQmbQUEzo9MYyBKYHhev71iofDAbAARejYV21FuZnZHyH59/nutrition%20facts%20100g%20enfamil%20toddler%20transition.jpg\",\"https://cdn.steemitimages.com/DQmQCq9wFybtBvW36AR2wt2ZuhmhQhfT986qVdTxhmVSkFv/nutrition%20facts%20100g%20enfamil%20toddler%20premium.jpg\"],\"links\":[\"https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):\",\"https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/\",\"https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)\",\"https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}cn-cutie.piereplied to @spearous / 20180528t195606648z-post2018/05/28 19:56:06
cn-cutie.piereplied to @spearous / 20180528t195606648z-post
2018/05/28 19:56:06
| parent author | spearous |
| parent permlink | 1 |
| author | cn-cutie.pie |
| permlink | 20180528t195606648z-post |
| title | |
| body | @spearous, steemit上我觉得只需要静静读你的贴就值了~~~  |
| json metadata | {"tags":["cn"]} |
| Transaction Info | Block #22834591/Trx 4a68a8fc06877d6160387f352dabdf9f55c44294 |
View Raw JSON Data
{
"trx_id": "4a68a8fc06877d6160387f352dabdf9f55c44294",
"block": 22834591,
"trx_in_block": 50,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T19:56:06",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "1",
"author": "cn-cutie.pie",
"permlink": "20180528t195606648z-post",
"title": "",
"body": "@spearous, steemit上我觉得只需要静静读你的贴就值了~~~ ",
"json_metadata": "{\"tags\":[\"cn\"]}"
}
]
}cn-cutie.pieupvoted (29.21%) @spearous / 12018/05/28 19:56:03
cn-cutie.pieupvoted (29.21%) @spearous / 1
2018/05/28 19:56:03
| voter | cn-cutie.pie |
| author | spearous |
| permlink | 1 |
| weight | 2921 (29.21%) |
| Transaction Info | Block #22834590/Trx 6cdfa6568a93f8df54c36b4106cd3dad7b8940eb |
View Raw JSON Data
{
"trx_id": "6cdfa6568a93f8df54c36b4106cd3dad7b8940eb",
"block": 22834590,
"trx_in_block": 65,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T19:56:03",
"op": [
"vote",
{
"voter": "cn-cutie.pie",
"author": "spearous",
"permlink": "1",
"weight": 2921
}
]
}2018/05/28 19:51:51
2018/05/28 19:51:51
| parent author | |
| parent permlink | cn |
| author | spearous |
| permlink | 1 |
| title | 1岁小孩要不要吃全脂牛奶 |
| body | 在网上看了一下,竟然有两种截然相反的看法。国内的主流看法是不要加;国外的主流看法,包括欧美澳,都是1岁开始加。 这个问题,看似表述清晰,但根据网上很多人的理解,还是模糊之处。问题集中在: 1 全脂牛奶有什么好处?国内和国外的看法不同的原因是什么?是有各自的前提,所以结论不同,还是说一方是对的,另一方是错的? 2 吃全脂牛奶,是不是意味着就要把奶粉断了? 3 如果有其他食物和全脂牛奶一起吃,那么有什么禁忌? 4 既然吃全脂牛奶,那么量的上限是多少? 5 既然开始吃全脂牛奶,那什么时候停还是一直吃下去? 6 如果碰到过敏的孩子,会有什么症状;或者说怎么知道小孩是不是对全脂牛奶过敏? 我并非专家,但想到这些问题是可能不止我会关心,而是每个家长都会在意。所以,在这集中收集一些网上的资料,并且给出我自己的想法给大家参考: ==================================================================================== # 1和2 全脂牛奶有什么好处?吃全脂牛奶,是不是意味着就要把奶粉断了? 首先,全脂牛奶的好处肯定是有额外的营养。但究竟有什么利弊呢?这里放几张营养表格(数据来源:美国食品卫生管理局USDA),当然实际含量根据奶源也是有不同的。   全脂奶的营养主要包括蛋白质,脂肪和脂溶性物质(包括胆固醇,维生素A, D, E和类胡萝卜素),其他维生素(B族维生素),乳糖,微量元素和矿物质(钾,钙,钠,铁等) 脱脂奶和全脂奶的营养差别,主要在失去了脂肪和脂溶性物质,其他都是类似的。低脂奶的脂肪和脂溶性物质在全脂和脱脂之间。 配方奶根据品牌不同,所含营养也有区别,这里放的是美赞臣美国市场版本的两种,toddler premium(上图,1-3岁)和toddler transition(下图9-18个月):   结论: 脱脂奶缺乏必要的脂溶性维生素,因此就不推荐了。以下就比较全脂牛奶和配方奶。 而如果将配方奶和全脂牛奶比较,很容看出,糖含量是很不同的。因为这里比较的是沏好的奶粉的量,所以是100mL对比全脂奶的100g。表格里显示,全脂奶100g是4.8g糖,而premium toddler 100mL是8.5g糖,多了一倍。我个人还是倾向于糖含量比较少的。所以就此而言,全脂奶是优于美赞臣配方奶的。 对于脂肪含量,因为在这个年龄的幼儿,神经和大脑发育需要脂肪,尤其是不饱和脂肪,因此这一项应该不低于3%。另外,可以注意到人类母乳里不饱和脂肪有2.2g,而全脂牛奶为1g左右也可以发现确实是不同动物的对生长的需求不一样啊。母乳对神经和大脑发育更好(如果看一下钙和维生素D的含量,就可以发现全脂牛奶含量尤其多,可能因为牛对骨骼发育的需求比人类大得多吧)配方奶的不饱和脂肪含量大约在1.6g左右,也是可以的。 对于微量元素,主要考察铁,钙和维生素D。首先,这个阶段的婴幼儿是需要这些铁,钙的,而维生素C有助于贴的吸收,维生素D对钙吸收极为重要。很奇怪,母乳里铁含量很低。这可能是因为在胎儿阶段已经在体内积累的足够的铁吧(https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH): 铁的推荐值为每日7mg (https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/) 维生素C为每日15mg (https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/) 钙为每日700mg (https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/) 维生素D推荐值为每天600IU(15mcg) (https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/) 和前面的营养表格对比,就发现不管是母乳还是全脂牛奶,铁和维生素C几乎没有。USDA的表格用的百分比,含义是可以提供每日推荐量的百分比。比如全脂牛奶的维生素D为12%,即100g全脂牛奶可以提供每日所需推荐量的12%(https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf) 所以,想达到维生素D和钙的每日推荐量,需要约1000g全脂牛奶。但是,下文会提到,全脂牛奶的每日饮用量,据美国儿童医学会旗下网站的数据,不应超过32盎司(约960mL或1quart)(https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx) 所以,纯靠全脂牛奶是不能实现这几种矿物质的补充的。而按照Enfamil的配方,可以算出,大约需要700mL即可满足以上四种营养物质的补充。但是,尽管配方奶在数字上够上标准了,但在营养物质的具体存在形式上,比如钙是以什么化合物存在于配方奶中的,我们都是不知道的。公认,牛奶中的钙是比较容易吸收的,而某些补钙剂用的是碳酸钙之类的无机钙,是不好吸收的。所以,以牛奶,豆奶的形式补充钙是很重要的。 所以,结论就是,为了补充脂肪尤其是不饱和脂肪的需要,也为了钙等容易吸收,应该加入全脂牛奶。但在加入全脂牛奶的同时,因为受限于每日不能超过32oz(960mL或1quart),我们必须同时加入配方奶,或者其他辅食,否则至少在铁、钙和维生素C、D上是稍微欠缺的。 最后,打算稍微讨论一下,国内和国外在这点上的区别。以下几种机构的说法: >>> 美国儿科协会AAP 当宝宝1岁之后,你可以给他全脂牛奶或者低脂(2%)牛奶,同固体辅食(麦片、蔬菜、水果、肉)一起提供均衡的饮食。但他一天最多喝1夸脱(约946毫升)牛奶。更多的奶会提供过多的热量,同时减少他对于其他食物的胃口。 >>> 世界卫生组织WHO 到1岁,大多数宝宝都可以和家庭其他成员吃一样的食物了。全脂牛奶在生命的头2年很重要。因为不含必需的脂肪酸、缺乏脂溶性维生素并且肾负荷较高,不推荐将脱脂牛奶作为2岁以内的儿童主要食物。低脂牛奶可以在12个月之后添加。 >>> 香港地区卫生署 一岁幼儿已能从多样化的饮食摄取所需的营养。家长需注意奶只是一岁或以上幼儿均衡饮食的一部分,亦是一种较易获取钙质的来源。……家长可让幼儿(指一岁后*OK妈注)饮用较配方奶便宜的牛奶(包括鲜牛奶、冷藏或保鲜装UHT牛奶、或全脂奶粉)。家长无须为幼儿转用成长或助长配方奶 (即「3」、 「4」号)摄取额外营养。 >>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐一 普通鲜奶、酸奶、奶酪等的蛋白质和矿物质含量远高于母乳,增加婴幼儿肾脏负担,对于12-24月龄幼儿可以将其作为食物多样化的一部分而逐渐尝试,但建议少量进食为宜,不能以此完全替代母乳或配方奶。 >>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐二 13~24个月龄幼儿的奶量应维持约500ml,每天1个鸡蛋加50-75g肉禽鱼,每天50~100g的谷物类,蔬菜、水果的量仍然以幼儿需要而定。不能母乳喂养或母乳喂养不足时,仍然建议以合适的幼儿配方奶作为补充,可引入少量鲜牛奶、酸奶、奶酪等,作为幼儿辅食的一部分。 可以看到国外基本都是推荐在1岁开始尝试全脂牛奶。而国内的建议,在膳食指南2016里建议引入少量鲜牛奶。我个人分析,这是因为膳食指南里,已经建议了谷物等其他食物,所以把鲜奶作为补充。众所周知,因为膳食结构的不同,亚洲人吃稻米比较多,吃奶制品少,因而很多人有乳糖不耐症而不能吃奶制品;而欧美人吃稻米少,吃奶制品多,因而很多人有麸质不耐受而不能吃稻米。排除了食物过敏的情况之后,食物不耐症,如乳糖不耐症主要是因为成年后喝奶少了,因此乳糖消化酶的表达量就低了,因此喝奶就无法分解其中的乳糖。然而,如果你持续喝奶很长一段时间,如3个月以上,你会发现你不再拉肚子,因为此时你的身体根据你的膳食结构重新调整了消化酶的表达量,你因此可以分解牛奶了。当然,有时候食物过敏也是类似的症状,这个通过持续喝奶是无法消除的。 因此,其实国内和国外的建议的分歧,其实是前提,也就是各自国家居民膳食结构的不同产生的。我们国家国内的人,成年之后基本是以稻米为主,因此1岁后给幼儿加入谷物,而此时加入全脂奶意义不大。国外的人因为依赖奶制品较多,所以1岁后加入全脂奶也是可以理解的。所以,如果是国外的话,完全可以慢慢以全脂奶为主,而如果是国内的话,以谷物为主就可以了,全脂奶应该作为营养补充来使用。 |
| json metadata | {"tags":["cn","cn-reader","baby","infant","nutrient"],"image":["https://cdn.steemitimages.com/DQmadiu6uYAYKxBzNJGHjMK1jK6p4zFSGnbs3qRdMPJAoPX/nutrition%20facts%20100g%20whole%20milk.jpg","https://cdn.steemitimages.com/DQmczL54Db9QodUM62Ej7YByCv3uEqdgMVSdaCQqr2iy43S/nutrition%20facts%20100g%201percent%20milk.jpg","https://cdn.steemitimages.com/DQmbQUEzo9MYyBKYHhev71iofDAbAARejYV21FuZnZHyH59/nutrition%20facts%20100g%20enfamil%20toddler%20transition.jpg","https://cdn.steemitimages.com/DQmQCq9wFybtBvW36AR2wt2ZuhmhQhfT986qVdTxhmVSkFv/nutrition%20facts%20100g%20enfamil%20toddler%20premium.jpg"],"links":["https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):","https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)","https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)","https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)","https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/","https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)","https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #22834506/Trx 7dc92e57b0f082c68b86a69c1e59db617aeda409 |
View Raw JSON Data
{
"trx_id": "7dc92e57b0f082c68b86a69c1e59db617aeda409",
"block": 22834506,
"trx_in_block": 11,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T19:51:51",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "cn",
"author": "spearous",
"permlink": "1",
"title": "1岁小孩要不要吃全脂牛奶",
"body": "在网上看了一下,竟然有两种截然相反的看法。国内的主流看法是不要加;国外的主流看法,包括欧美澳,都是1岁开始加。\n\n这个问题,看似表述清晰,但根据网上很多人的理解,还是模糊之处。问题集中在:\n\n1 全脂牛奶有什么好处?国内和国外的看法不同的原因是什么?是有各自的前提,所以结论不同,还是说一方是对的,另一方是错的?\n\n2 吃全脂牛奶,是不是意味着就要把奶粉断了?\n\n3 如果有其他食物和全脂牛奶一起吃,那么有什么禁忌?\n\n4 既然吃全脂牛奶,那么量的上限是多少?\n\n5 既然开始吃全脂牛奶,那什么时候停还是一直吃下去?\n\n6 如果碰到过敏的孩子,会有什么症状;或者说怎么知道小孩是不是对全脂牛奶过敏? \n\n\n我并非专家,但想到这些问题是可能不止我会关心,而是每个家长都会在意。所以,在这集中收集一些网上的资料,并且给出我自己的想法给大家参考:\n\n====================================================================================\n\n# 1和2 全脂牛奶有什么好处?吃全脂牛奶,是不是意味着就要把奶粉断了?\n\n首先,全脂牛奶的好处肯定是有额外的营养。但究竟有什么利弊呢?这里放几张营养表格(数据来源:美国食品卫生管理局USDA),当然实际含量根据奶源也是有不同的。\n\n\n\n\n\n\n全脂奶的营养主要包括蛋白质,脂肪和脂溶性物质(包括胆固醇,维生素A, D, E和类胡萝卜素),其他维生素(B族维生素),乳糖,微量元素和矿物质(钾,钙,钠,铁等)\n\n脱脂奶和全脂奶的营养差别,主要在失去了脂肪和脂溶性物质,其他都是类似的。低脂奶的脂肪和脂溶性物质在全脂和脱脂之间。\n\n配方奶根据品牌不同,所含营养也有区别,这里放的是美赞臣美国市场版本的两种,toddler premium(上图,1-3岁)和toddler transition(下图9-18个月):\n\n\n\n\n\n\n结论:\n脱脂奶缺乏必要的脂溶性维生素,因此就不推荐了。以下就比较全脂牛奶和配方奶。\n\n而如果将配方奶和全脂牛奶比较,很容看出,糖含量是很不同的。因为这里比较的是沏好的奶粉的量,所以是100mL对比全脂奶的100g。表格里显示,全脂奶100g是4.8g糖,而premium toddler 100mL是8.5g糖,多了一倍。我个人还是倾向于糖含量比较少的。所以就此而言,全脂奶是优于美赞臣配方奶的。\n\n对于脂肪含量,因为在这个年龄的幼儿,神经和大脑发育需要脂肪,尤其是不饱和脂肪,因此这一项应该不低于3%。另外,可以注意到人类母乳里不饱和脂肪有2.2g,而全脂牛奶为1g左右也可以发现确实是不同动物的对生长的需求不一样啊。母乳对神经和大脑发育更好(如果看一下钙和维生素D的含量,就可以发现全脂牛奶含量尤其多,可能因为牛对骨骼发育的需求比人类大得多吧)配方奶的不饱和脂肪含量大约在1.6g左右,也是可以的。\n\n对于微量元素,主要考察铁,钙和维生素D。首先,这个阶段的婴幼儿是需要这些铁,钙的,而维生素C有助于贴的吸收,维生素D对钙吸收极为重要。很奇怪,母乳里铁含量很低。这可能是因为在胎儿阶段已经在体内积累的足够的铁吧(https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):\n\n铁的推荐值为每日7mg (https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)\n\n维生素C为每日15mg (https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)\n\n钙为每日700mg (https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)\n\n维生素D推荐值为每天600IU(15mcg) (https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/)\n\n和前面的营养表格对比,就发现不管是母乳还是全脂牛奶,铁和维生素C几乎没有。USDA的表格用的百分比,含义是可以提供每日推荐量的百分比。比如全脂牛奶的维生素D为12%,即100g全脂牛奶可以提供每日所需推荐量的12%(https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)\n\n所以,想达到维生素D和钙的每日推荐量,需要约1000g全脂牛奶。但是,下文会提到,全脂牛奶的每日饮用量,据美国儿童医学会旗下网站的数据,不应超过32盎司(约960mL或1quart)(https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)\n\n所以,纯靠全脂牛奶是不能实现这几种矿物质的补充的。而按照Enfamil的配方,可以算出,大约需要700mL即可满足以上四种营养物质的补充。但是,尽管配方奶在数字上够上标准了,但在营养物质的具体存在形式上,比如钙是以什么化合物存在于配方奶中的,我们都是不知道的。公认,牛奶中的钙是比较容易吸收的,而某些补钙剂用的是碳酸钙之类的无机钙,是不好吸收的。所以,以牛奶,豆奶的形式补充钙是很重要的。\n\n所以,结论就是,为了补充脂肪尤其是不饱和脂肪的需要,也为了钙等容易吸收,应该加入全脂牛奶。但在加入全脂牛奶的同时,因为受限于每日不能超过32oz(960mL或1quart),我们必须同时加入配方奶,或者其他辅食,否则至少在铁、钙和维生素C、D上是稍微欠缺的。\n\n\n\n\n\n最后,打算稍微讨论一下,国内和国外在这点上的区别。以下几种机构的说法:\n\n>>> 美国儿科协会AAP\n\n当宝宝1岁之后,你可以给他全脂牛奶或者低脂(2%)牛奶,同固体辅食(麦片、蔬菜、水果、肉)一起提供均衡的饮食。但他一天最多喝1夸脱(约946毫升)牛奶。更多的奶会提供过多的热量,同时减少他对于其他食物的胃口。\n\n>>> 世界卫生组织WHO\n\n到1岁,大多数宝宝都可以和家庭其他成员吃一样的食物了。全脂牛奶在生命的头2年很重要。因为不含必需的脂肪酸、缺乏脂溶性维生素并且肾负荷较高,不推荐将脱脂牛奶作为2岁以内的儿童主要食物。低脂牛奶可以在12个月之后添加。\n\n>>> 香港地区卫生署\n\n一岁幼儿已能从多样化的饮食摄取所需的营养。家长需注意奶只是一岁或以上幼儿均衡饮食的一部分,亦是一种较易获取钙质的来源。……家长可让幼儿(指一岁后*OK妈注)饮用较配方奶便宜的牛奶(包括鲜牛奶、冷藏或保鲜装UHT牛奶、或全脂奶粉)。家长无须为幼儿转用成长或助长配方奶 (即「3」、 「4」号)摄取额外营养。\n\n>>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐一\n\n普通鲜奶、酸奶、奶酪等的蛋白质和矿物质含量远高于母乳,增加婴幼儿肾脏负担,对于12-24月龄幼儿可以将其作为食物多样化的一部分而逐渐尝试,但建议少量进食为宜,不能以此完全替代母乳或配方奶。\n\n>>> 中国营养学会 中国居民膳食指南2016 第二部分,7~24个月龄婴幼儿喂养指南,推荐二\n\n13~24个月龄幼儿的奶量应维持约500ml,每天1个鸡蛋加50-75g肉禽鱼,每天50~100g的谷物类,蔬菜、水果的量仍然以幼儿需要而定。不能母乳喂养或母乳喂养不足时,仍然建议以合适的幼儿配方奶作为补充,可引入少量鲜牛奶、酸奶、奶酪等,作为幼儿辅食的一部分。\n\n\n可以看到国外基本都是推荐在1岁开始尝试全脂牛奶。而国内的建议,在膳食指南2016里建议引入少量鲜牛奶。我个人分析,这是因为膳食指南里,已经建议了谷物等其他食物,所以把鲜奶作为补充。众所周知,因为膳食结构的不同,亚洲人吃稻米比较多,吃奶制品少,因而很多人有乳糖不耐症而不能吃奶制品;而欧美人吃稻米少,吃奶制品多,因而很多人有麸质不耐受而不能吃稻米。排除了食物过敏的情况之后,食物不耐症,如乳糖不耐症主要是因为成年后喝奶少了,因此乳糖消化酶的表达量就低了,因此喝奶就无法分解其中的乳糖。然而,如果你持续喝奶很长一段时间,如3个月以上,你会发现你不再拉肚子,因为此时你的身体根据你的膳食结构重新调整了消化酶的表达量,你因此可以分解牛奶了。当然,有时候食物过敏也是类似的症状,这个通过持续喝奶是无法消除的。\n\n因此,其实国内和国外的建议的分歧,其实是前提,也就是各自国家居民膳食结构的不同产生的。我们国家国内的人,成年之后基本是以稻米为主,因此1岁后给幼儿加入谷物,而此时加入全脂奶意义不大。国外的人因为依赖奶制品较多,所以1岁后加入全脂奶也是可以理解的。所以,如果是国外的话,完全可以慢慢以全脂奶为主,而如果是国内的话,以谷物为主就可以了,全脂奶应该作为营养补充来使用。",
"json_metadata": "{\"tags\":[\"cn\",\"cn-reader\",\"baby\",\"infant\",\"nutrient\"],\"image\":[\"https://cdn.steemitimages.com/DQmadiu6uYAYKxBzNJGHjMK1jK6p4zFSGnbs3qRdMPJAoPX/nutrition%20facts%20100g%20whole%20milk.jpg\",\"https://cdn.steemitimages.com/DQmczL54Db9QodUM62Ej7YByCv3uEqdgMVSdaCQqr2iy43S/nutrition%20facts%20100g%201percent%20milk.jpg\",\"https://cdn.steemitimages.com/DQmbQUEzo9MYyBKYHhev71iofDAbAARejYV21FuZnZHyH59/nutrition%20facts%20100g%20enfamil%20toddler%20transition.jpg\",\"https://cdn.steemitimages.com/DQmQCq9wFybtBvW36AR2wt2ZuhmhQhfT986qVdTxhmVSkFv/nutrition%20facts%20100g%20enfamil%20toddler%20premium.jpg\"],\"links\":[\"https://www.haodf.com/zhuanjiaguandian/docliuyang123_4827797033.htm)。对于1-3岁幼儿(数据来源:美国国立卫生研究院NIH):\",\"https://ods.od.nih.gov/factsheets/Iron-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/VitaminC-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/Calcium-HealthProfessional/)\",\"https://ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/\",\"https://whatscooking.fns.usda.gov/sites/default/files/factsheets/USDA_HCFS_NONFATDRYMILK100065Oct2012.pdf)\",\"https://www.healthychildren.org/English/ages-stages/toddler/nutrition/pages/Dietary-Supplements-for-Toddlers.aspx)\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}2018/05/28 16:02:09
2018/05/28 16:02:09
| delegator | steem |
| delegatee | spearous |
| vesting shares | 29470.593833 VESTS |
| Transaction Info | Block #22829914/Trx 523d871950a98e9727d4facca34f2c5a2139ae1d |
View Raw JSON Data
{
"trx_id": "523d871950a98e9727d4facca34f2c5a2139ae1d",
"block": 22829914,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T16:02:09",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "29470.593833 VESTS"
}
]
}2018/05/28 15:42:21
2018/05/28 15:42:21
| required auths | [] |
| required posting auths | ["spearous"] |
| id | follow |
| json | ["follow",{"follower":"spearous","following":"stepbie","what":["blog"]}] |
| Transaction Info | Block #22829518/Trx a3595b31867adae2e1f07bdd440a7f44ff1f3f2e |
View Raw JSON Data
{
"trx_id": "a3595b31867adae2e1f07bdd440a7f44ff1f3f2e",
"block": 22829518,
"trx_in_block": 34,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-28T15:42:21",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"spearous"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"spearous\",\"following\":\"stepbie\",\"what\":[\"blog\"]}]"
}
]
}2018/05/17 06:23:48
2018/05/17 06:23:48
| delegator | steem |
| delegatee | spearous |
| vesting shares | 9140.739730 VESTS |
| Transaction Info | Block #22501974/Trx e236edbe4b1512f62c547a388d81d649e10618f4 |
View Raw JSON Data
{
"trx_id": "e236edbe4b1512f62c547a388d81d649e10618f4",
"block": 22501974,
"trx_in_block": 6,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-05-17T06:23:48",
"op": [
"delegate_vesting_shares",
{
"delegator": "steem",
"delegatee": "spearous",
"vesting_shares": "9140.739730 VESTS"
}
]
}exploratorupvoted (100.00%) @spearous / 2h46y2018/02/16 17:23:21
exploratorupvoted (100.00%) @spearous / 2h46y
2018/02/16 17:23:21
| voter | explorator |
| author | spearous |
| permlink | 2h46y |
| weight | 10000 (100.00%) |
| Transaction Info | Block #19925751/Trx b20ed12a034367e14b3e09d515adc8f1c1dfa699 |
View Raw JSON Data
{
"trx_id": "b20ed12a034367e14b3e09d515adc8f1c1dfa699",
"block": 19925751,
"trx_in_block": 25,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-02-16T17:23:21",
"op": [
"vote",
{
"voter": "explorator",
"author": "spearous",
"permlink": "2h46y",
"weight": 10000
}
]
}stepbiereplied to @spearous / re-spearous-2h46y-20180215t051041135z2018/02/15 05:10:39
stepbiereplied to @spearous / re-spearous-2h46y-20180215t051041135z
2018/02/15 05:10:39
| parent author | spearous |
| parent permlink | 2h46y |
| author | stepbie |
| permlink | re-spearous-2h46y-20180215t051041135z |
| title | |
| body | Read more and write more would definitely help!! :) Come follow us! :) |
| json metadata | {"tags":["writing"],"app":"steemit/0.1"} |
| Transaction Info | Block #19882333/Trx 292dde2adffd2bb71f9553d85bf1f2062c6e23a3 |
View Raw JSON Data
{
"trx_id": "292dde2adffd2bb71f9553d85bf1f2062c6e23a3",
"block": 19882333,
"trx_in_block": 60,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-02-15T05:10:39",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "2h46y",
"author": "stepbie",
"permlink": "re-spearous-2h46y-20180215t051041135z",
"title": "",
"body": "Read more and write more would definitely help!! :) Come follow us! :)",
"json_metadata": "{\"tags\":[\"writing\"],\"app\":\"steemit/0.1\"}"
}
]
}2018/02/15 05:09:09
2018/02/15 05:09:09
| voter | stepbie |
| author | spearous |
| permlink | 2h46y |
| weight | 10000 (100.00%) |
| Transaction Info | Block #19882303/Trx c1db47c4aa0b7e8df1dd94ecf2f67036d308f062 |
View Raw JSON Data
{
"trx_id": "c1db47c4aa0b7e8df1dd94ecf2f67036d308f062",
"block": 19882303,
"trx_in_block": 47,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-02-15T05:09:09",
"op": [
"vote",
{
"voter": "stepbie",
"author": "spearous",
"permlink": "2h46y",
"weight": 10000
}
]
}2018/02/15 05:08:24
2018/02/15 05:08:24
| parent author | |
| parent permlink | writing |
| author | spearous |
| permlink | 2h46y |
| title | 今天体会了一下 中文写作和英文写作的区别 |
| body | 我想每个人都听过关于中文和英文写作的经典比较:英文是开门见山式,而中文是云里雾绕式;英文结论或者主题直接给你,而中文会小心谨慎的藏起来让你找。我也是听的似懂非懂:中文也有开门见山式的开局,也有直接切入主题的文章,这怎么不一样呢? 其实,我自己总结,写作就是把自己的积累的素材,论据,进行提炼,以把自己想法,观点通过一定的构思展示给读者看。这里所说的构思,主要是指行文逻辑而不是整体的布局谋篇。中文的行文逻辑,由读者凭自己的兴趣,钻研出来,这是阅读的乐趣。记得以前讲课的时候,也会就不同的逻辑出题考察。然而,英文的行文逻辑的表达方式,则完全不同。 英文的行文逻辑,讲究直白。这应该和英文的语法有关。中文表示逻辑的连词不多,句子之间的逻辑全靠句子的意思来连接。但英文的写作,连词是必不可少的的,句子之间的必须要靠连词来表示逻辑。如果不用连词,英文读者几乎不能判断句子间的逻辑,从而会感到迷惑,看不懂。这点对中文读者,就完全不成问题,因为中文读者习惯了,由句子的意思来判断逻辑。 这两种方式,通过连词或者意思来判断,各有各的好处。就我的理解,通过连词来判断逻辑,作者可以引导读者按照他的构思来阅读文章,这样读者可以最大程度的理解论证。而通过意思来判断逻辑,这种方式会受到读者的阅读经验,阅读水平甚至社会阅历的影响。打个比方,鲁迅的作品,初中生读来,很多细节根本不会注意到,从而作品的内涵,很难被理解,进而会产生作品很平庸的想法。然而,如果是有经验的阅读者,比如作家,来读鲁迅的作品,会有完全不一样的想法。这个可以见《余华:鲁迅是我这辈子唯一讨厌过的作家》里,余华的经历。 中文和英文的这个区别,其实也不新鲜,网上也有关于行文逻辑在这个层面上的区别的描述。但是,网上少见的是,这个区别所导致的更进一步的后果。多个句子的按照逻辑组合在一起,在一个段落里,会组成一个意群,而这个意群的表达是一个建立在句子间逻辑之上的表达。一个好的意群的表达,在中文写作里,即不同层次的逻辑,互相呼应;在英文写作里称为“coherence”。coherence不只会由句子间逻辑表达,更上一层的coherence也会由段落间的逻辑来表达,从而使整个文章浑然一体。 对比来讲,中文的意群的结构,显然不会由连词来表达,但仍会给出简单的词,或者线索,但基本来说,识别而是由读者自己进行的,由自己去体会。然而,英文的意群能否coherence,同样是由运用良好的连词们来决定的。习惯了中文的作者们去写英文,一般会在这个层面上吃亏。因为,既然句子内的逻辑在英文里,是由连词们来表达的,那么简单来说,中文作者们把连词写明,把逻辑讲清就可以了。所以,句子内或者两个句子间的写作风格的改变并不困难。然后,如何驾驭大量句子、段落,做好从中文向英文的转变,就不是简单的写明连词就可以的,从而中文作者一般都会在这个层面上吃亏。 其实,英语读者来读中文作者们的英文,大部分不习惯由自己来推导句子逻辑这个要求,但如果是同行评议,一般也能够读懂句子内的逻辑。但是,如果要求他们能读懂不显含逻辑的句群,段落,就强人所难了。因此,也有大部分英文读者所说的,逻辑不清,其实是指句群和段落。但因为这个评价,在我们听起来用的是同一个词(“逻辑不清”),因此很多时候,都只会检查句子内,或者两个句子间的逻辑,而不会去检查句群,段落内的逻辑。因此也会对英语读者的评议感到不理解。 今天,总算是厘清了这两个层面上的中文和英文的区别,希望以后也能写出让英文读者读得懂的英文。 |
| json metadata | {"tags":["writing","cn","cn-reader"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19882288/Trx 3438f37b254f202cf48105de600e1bc8f015439d |
View Raw JSON Data
{
"trx_id": "3438f37b254f202cf48105de600e1bc8f015439d",
"block": 19882288,
"trx_in_block": 9,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-02-15T05:08:24",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "writing",
"author": "spearous",
"permlink": "2h46y",
"title": "今天体会了一下 中文写作和英文写作的区别",
"body": "我想每个人都听过关于中文和英文写作的经典比较:英文是开门见山式,而中文是云里雾绕式;英文结论或者主题直接给你,而中文会小心谨慎的藏起来让你找。我也是听的似懂非懂:中文也有开门见山式的开局,也有直接切入主题的文章,这怎么不一样呢?\n\n其实,我自己总结,写作就是把自己的积累的素材,论据,进行提炼,以把自己想法,观点通过一定的构思展示给读者看。这里所说的构思,主要是指行文逻辑而不是整体的布局谋篇。中文的行文逻辑,由读者凭自己的兴趣,钻研出来,这是阅读的乐趣。记得以前讲课的时候,也会就不同的逻辑出题考察。然而,英文的行文逻辑的表达方式,则完全不同。\n\n英文的行文逻辑,讲究直白。这应该和英文的语法有关。中文表示逻辑的连词不多,句子之间的逻辑全靠句子的意思来连接。但英文的写作,连词是必不可少的的,句子之间的必须要靠连词来表示逻辑。如果不用连词,英文读者几乎不能判断句子间的逻辑,从而会感到迷惑,看不懂。这点对中文读者,就完全不成问题,因为中文读者习惯了,由句子的意思来判断逻辑。\n\n这两种方式,通过连词或者意思来判断,各有各的好处。就我的理解,通过连词来判断逻辑,作者可以引导读者按照他的构思来阅读文章,这样读者可以最大程度的理解论证。而通过意思来判断逻辑,这种方式会受到读者的阅读经验,阅读水平甚至社会阅历的影响。打个比方,鲁迅的作品,初中生读来,很多细节根本不会注意到,从而作品的内涵,很难被理解,进而会产生作品很平庸的想法。然而,如果是有经验的阅读者,比如作家,来读鲁迅的作品,会有完全不一样的想法。这个可以见《余华:鲁迅是我这辈子唯一讨厌过的作家》里,余华的经历。\n\n中文和英文的这个区别,其实也不新鲜,网上也有关于行文逻辑在这个层面上的区别的描述。但是,网上少见的是,这个区别所导致的更进一步的后果。多个句子的按照逻辑组合在一起,在一个段落里,会组成一个意群,而这个意群的表达是一个建立在句子间逻辑之上的表达。一个好的意群的表达,在中文写作里,即不同层次的逻辑,互相呼应;在英文写作里称为“coherence”。coherence不只会由句子间逻辑表达,更上一层的coherence也会由段落间的逻辑来表达,从而使整个文章浑然一体。\n\n对比来讲,中文的意群的结构,显然不会由连词来表达,但仍会给出简单的词,或者线索,但基本来说,识别而是由读者自己进行的,由自己去体会。然而,英文的意群能否coherence,同样是由运用良好的连词们来决定的。习惯了中文的作者们去写英文,一般会在这个层面上吃亏。因为,既然句子内的逻辑在英文里,是由连词们来表达的,那么简单来说,中文作者们把连词写明,把逻辑讲清就可以了。所以,句子内或者两个句子间的写作风格的改变并不困难。然后,如何驾驭大量句子、段落,做好从中文向英文的转变,就不是简单的写明连词就可以的,从而中文作者一般都会在这个层面上吃亏。\n\n其实,英语读者来读中文作者们的英文,大部分不习惯由自己来推导句子逻辑这个要求,但如果是同行评议,一般也能够读懂句子内的逻辑。但是,如果要求他们能读懂不显含逻辑的句群,段落,就强人所难了。因此,也有大部分英文读者所说的,逻辑不清,其实是指句群和段落。但因为这个评价,在我们听起来用的是同一个词(“逻辑不清”),因此很多时候,都只会检查句子内,或者两个句子间的逻辑,而不会去检查句群,段落内的逻辑。因此也会对英语读者的评议感到不理解。\n\n今天,总算是厘清了这两个层面上的中文和英文的区别,希望以后也能写出让英文读者读得懂的英文。",
"json_metadata": "{\"tags\":[\"writing\",\"cn\",\"cn-reader\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-usaco-1-2-2-greedy-gift-givers2018/01/21 05:10:42
spearouspublished a new post: python3-usaco-1-2-2-greedy-gift-givers
2018/01/21 05:10:42
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-usaco-1-2-2-greedy-gift-givers |
| title | python3刷USACO题库 1.2.2 Greedy Gift Givers |
| body | @@ -775,19 +775,16 @@ n(dict)%0A -%3E%3E%3E + 3%0A%60%60%60%0A%E8%BE%93%E5%87%BA @@ -801,19 +801,16 @@ r(dict)%0A -%3E%3E%3E %7B'apple' @@ -874,12 +874,8 @@ s()%0A -%3E%3E%3E %5B'ap @@ -900,16 +900,17 @@ range'%5D%0A +%0A dict.val @@ -919,19 +919,17 @@ s()%0A -%3E%3E%3E %5B1,2,3%5D%0A +%0A dict @@ -941,11 +941,8 @@ s()%0A -%3E%3E%3E %7B'ap |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6","https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/","https://jianpengzhang.github.io/2017/02/26/2017022604/","http://blog.csdn.net/jfkidear/article/details/7532293"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19163180/Trx b7d301869a0294b532246935655dd8b698714b0e |
View Raw JSON Data
{
"trx_id": "b7d301869a0294b532246935655dd8b698714b0e",
"block": 19163180,
"trx_in_block": 20,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-21T05:10:42",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-usaco-1-2-2-greedy-gift-givers",
"title": "python3刷USACO题库 1.2.2 Greedy Gift Givers",
"body": "@@ -775,19 +775,16 @@\n n(dict)%0A\n-%3E%3E%3E\n \n+\n 3%0A%60%60%60%0A%E8%BE%93%E5%87%BA\n@@ -801,19 +801,16 @@\n r(dict)%0A\n-%3E%3E%3E\n %7B'apple'\n@@ -874,12 +874,8 @@\n s()%0A\n-%3E%3E%3E \n %5B'ap\n@@ -900,16 +900,17 @@\n range'%5D%0A\n+%0A\n dict.val\n@@ -919,19 +919,17 @@\n s()%0A\n-%3E%3E%3E\n %5B1,2,3%5D%0A\n+%0A\n dict\n@@ -941,11 +941,8 @@\n s()%0A\n-%3E%3E%3E\n %7B'ap\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6\",\"https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/\",\"https://jianpengzhang.github.io/2017/02/26/2017022604/\",\"http://blog.csdn.net/jfkidear/article/details/7532293\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}cn-naughty.boyreplied to @spearous / 20180120t160545953z-post2018/01/20 16:05:48
cn-naughty.boyreplied to @spearous / 20180120t160545953z-post
2018/01/20 16:05:48
| parent author | spearous |
| parent permlink | python3-usaco-1-2-2-greedy-gift-givers |
| author | cn-naughty.boy |
| permlink | 20180120t160545953z-post |
| title | |
| body | 不错不错! |
| json metadata | {"tags":["cn"]} |
| Transaction Info | Block #19147488/Trx fd35ea3bf690a4e3c7c13bccec9522fa7246931b |
View Raw JSON Data
{
"trx_id": "fd35ea3bf690a4e3c7c13bccec9522fa7246931b",
"block": 19147488,
"trx_in_block": 21,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-20T16:05:48",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "python3-usaco-1-2-2-greedy-gift-givers",
"author": "cn-naughty.boy",
"permlink": "20180120t160545953z-post",
"title": "",
"body": "不错不错!",
"json_metadata": "{\"tags\":[\"cn\"]}"
}
]
}cn-naughty.boyupvoted (8.93%) @spearous / python3-usaco-1-2-2-greedy-gift-givers2018/01/20 16:05:45
cn-naughty.boyupvoted (8.93%) @spearous / python3-usaco-1-2-2-greedy-gift-givers
2018/01/20 16:05:45
| voter | cn-naughty.boy |
| author | spearous |
| permlink | python3-usaco-1-2-2-greedy-gift-givers |
| weight | 893 (8.93%) |
| Transaction Info | Block #19147487/Trx 58263b299a0dbd13f0c70b61002183af517380c4 |
View Raw JSON Data
{
"trx_id": "58263b299a0dbd13f0c70b61002183af517380c4",
"block": 19147487,
"trx_in_block": 39,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-20T16:05:45",
"op": [
"vote",
{
"voter": "cn-naughty.boy",
"author": "spearous",
"permlink": "python3-usaco-1-2-2-greedy-gift-givers",
"weight": 893
}
]
}spearouspublished a new post: python3-usaco-1-2-2-greedy-gift-givers2018/01/20 16:04:24
spearouspublished a new post: python3-usaco-1-2-2-greedy-gift-givers
2018/01/20 16:04:24
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-usaco-1-2-2-greedy-gift-givers |
| title | python3刷USACO题库 1.2.2 Greedy Gift Givers |
| body | 这个仍然是基础语言题目。题目内容很简单,大致是一组朋友互相赠红包,每个人可能赠出,也可能收到,经过几轮之后,打印出最终每个人的余额。 对于python3来说,字典这个数据结构,很适合这个问题,所以首先要学一下字典相关的操作。然后是python3和python2关于字典的一个小坑以及文件读取函数的一个小坑, ### 字典 字典是一种可变容器模型,由很多组键值(key-value)对组成。其中key是创立后不能改变的,而value是可以随时修改的。key由不能改变的数据类型构成,如字符串,数字,元组等;而value可以是任何数据类型,可以是单个数值变量,也可以是数组等。key不能重复定义,否则会保留最后一个。 涉及的简单操作,包括创建: ``` dict1 = { 'apple': 1 }; dict2 = { 'banana': 2, 'orange': 3 }; ``` 修改: ``` dict = {'apple': 1} dict['apple'] =2 (update) dict['banana'] = 3 (add new member) ``` 删除: ``` dict = {'apple': 1, 'banana': 2, 'orange': 3} del dict['apple'] # 删除键 'apple' dict.clear() # 清空字典 del dict # 删除字典 ``` 其他内置操作: ``` 计算字典元素总个数,即键的总数 ``` len(dict) >>>3 ``` 输出字典: ``` str(dict) >>>{'apple':1, 'banana':2, 'orange':3} ``` 只输出所有的keys: ``` dict.keys() >>> ['apple', 'banana', 'orange'] dict.values() >>>[1,2,3] dict.items() >>>{'apple':1, 'banana':2, 'orange':3} 检测某键是否存在: ``` if 'Age' in dict: print("键 Age 存在") else : print("键 Age 不存在") ``` python3遍历字典: ``` for key, value in mydic.items() : print (key, value) ``` 曾经在python2里,存在一个mydic.iteritems()的方法,但python3已经去掉了。 ### 几个小坑 在这个题目里,有个要求,即最后打印每个人的余额时,需要按照最初给出组成员的顺序打印。对于python3.6版本,这个不成问题,因为python3.6的一个改动,即字典默认的排序是按照添加成员的顺序。而在python3.6以前的版本,这个是没有的。我的编译器是python3.6.2因此,默认是会给出正确的顺序。然而USACO的裁判机上估计是以前版本的python3,因此不能给出正确的结果。为了在python3.6以前,也能一样给出正确的结果,需要使用: ``` from collections import OrderedDict dict=OrderedDict() ``` 所以,我因为这个版本问题,在 本地上是正确输出,而到了OJ上则显示有错误。 另一个小坑是关于文件读取函数readline(),readlines()。默认这些函数会在读取的数据最后加上一个换行符。因此如果直接把通过readline()读取的人名放到字典里作为Key,实际上这些人名最后还多出来一个换行符。这样在最后打印结果的时候,就会连换行符一起打印出来。这样不符合题目要求的格式了(题目要求人名和余额在同一行)。所以需要strip方法来去掉多出的换行符: ``` fin = open ('gift1.in', 'r') dict[fin.readline().strip('\n')]=0 ``` 我的python3程序: ``` from collections import OrderedDict fin = open ('gift1.in', 'r') fout = open ('gift1.out', 'w') dict=OrderedDict() No_of_people=int(fin.readline()) for i in range(0, No_of_people): dict[fin.readline().strip('\n')]=0 while True: Person_send_out=fin.readline().strip('\n') print(Person_send_out+'\n') if Person_send_out=='': break send_out=fin.readline().strip('\n') Total_to_send=int(send_out.split(' ')[0]) No_of_portion=int(send_out.split(' ')[1]) print("{}".format(Total_to_send)) print("{}".format(No_of_portion)) if (Total_to_send==0): Each_portion=0 left_over=0 else: Each_portion=Total_to_send//No_of_portion left_over=Total_to_send%No_of_portion print("{}".format(Each_portion)) print("{}".format(left_over)) for i in range(0, No_of_portion): name1 = fin.readline().strip('\n') dict[name1] = dict[name1] + Each_portion dict[Person_send_out]= dict[Person_send_out] - Total_to_send + left_over for k,v in dict.items(): fout.write (k+' ') fout.write (str(v)+'\n') print (k,v) fout.close() ``` 参考资料: 1. https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6 2. https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/ 3. https://jianpengzhang.github.io/2017/02/26/2017022604/ 4. http://blog.csdn.net/jfkidear/article/details/7532293 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6","https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/","https://jianpengzhang.github.io/2017/02/26/2017022604/","http://blog.csdn.net/jfkidear/article/details/7532293"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19147460/Trx 401f0764a29f4e1b3d78272b694da909cf316afb |
View Raw JSON Data
{
"trx_id": "401f0764a29f4e1b3d78272b694da909cf316afb",
"block": 19147460,
"trx_in_block": 51,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-20T16:04:24",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-usaco-1-2-2-greedy-gift-givers",
"title": "python3刷USACO题库 1.2.2 Greedy Gift Givers",
"body": "这个仍然是基础语言题目。题目内容很简单,大致是一组朋友互相赠红包,每个人可能赠出,也可能收到,经过几轮之后,打印出最终每个人的余额。\n\n对于python3来说,字典这个数据结构,很适合这个问题,所以首先要学一下字典相关的操作。然后是python3和python2关于字典的一个小坑以及文件读取函数的一个小坑,\n\n### 字典\n字典是一种可变容器模型,由很多组键值(key-value)对组成。其中key是创立后不能改变的,而value是可以随时修改的。key由不能改变的数据类型构成,如字符串,数字,元组等;而value可以是任何数据类型,可以是单个数值变量,也可以是数组等。key不能重复定义,否则会保留最后一个。\n\n涉及的简单操作,包括创建:\n```\ndict1 = { 'apple': 1 };\ndict2 = { 'banana': 2, 'orange': 3 };\n```\n\n修改:\n```\ndict = {'apple': 1}\ndict['apple'] =2 (update)\ndict['banana'] = 3 (add new member)\n```\n\n删除:\n```\ndict = {'apple': 1, 'banana': 2, 'orange': 3}\ndel dict['apple'] # 删除键 'apple'\ndict.clear() # 清空字典\ndel dict # 删除字典\n```\n\n其他内置操作:\n```\n计算字典元素总个数,即键的总数\n```\nlen(dict)\n>>>3\n```\n输出字典:\n```\nstr(dict)\n>>>{'apple':1, 'banana':2, 'orange':3}\n```\n\n只输出所有的keys:\n```\ndict.keys()\n>>> ['apple', 'banana', 'orange']\ndict.values()\n>>>[1,2,3]\ndict.items()\n>>>{'apple':1, 'banana':2, 'orange':3}\n\n\n检测某键是否存在:\n```\nif 'Age' in dict:\n print(\"键 Age 存在\")\nelse :\n print(\"键 Age 不存在\")\n```\n\npython3遍历字典:\n```\nfor key, value in mydic.items() :\n print (key, value)\n```\n曾经在python2里,存在一个mydic.iteritems()的方法,但python3已经去掉了。\n\n\n### 几个小坑\n\n在这个题目里,有个要求,即最后打印每个人的余额时,需要按照最初给出组成员的顺序打印。对于python3.6版本,这个不成问题,因为python3.6的一个改动,即字典默认的排序是按照添加成员的顺序。而在python3.6以前的版本,这个是没有的。我的编译器是python3.6.2因此,默认是会给出正确的顺序。然而USACO的裁判机上估计是以前版本的python3,因此不能给出正确的结果。为了在python3.6以前,也能一样给出正确的结果,需要使用:\n\n```\nfrom collections import OrderedDict\ndict=OrderedDict()\n```\n所以,我因为这个版本问题,在 本地上是正确输出,而到了OJ上则显示有错误。\n\n\n另一个小坑是关于文件读取函数readline(),readlines()。默认这些函数会在读取的数据最后加上一个换行符。因此如果直接把通过readline()读取的人名放到字典里作为Key,实际上这些人名最后还多出来一个换行符。这样在最后打印结果的时候,就会连换行符一起打印出来。这样不符合题目要求的格式了(题目要求人名和余额在同一行)。所以需要strip方法来去掉多出的换行符:\n```\nfin = open ('gift1.in', 'r')\ndict[fin.readline().strip('\\n')]=0\n```\n\n\n我的python3程序:\n```\nfrom collections import OrderedDict\n\nfin = open ('gift1.in', 'r')\nfout = open ('gift1.out', 'w')\n\ndict=OrderedDict()\nNo_of_people=int(fin.readline())\nfor i in range(0, No_of_people):\n dict[fin.readline().strip('\\n')]=0\n \n \n \nwhile True:\n Person_send_out=fin.readline().strip('\\n')\n print(Person_send_out+'\\n')\n if Person_send_out=='':\n break\n \n send_out=fin.readline().strip('\\n')\n\n\n Total_to_send=int(send_out.split(' ')[0])\n No_of_portion=int(send_out.split(' ')[1])\n \n print(\"{}\".format(Total_to_send))\n print(\"{}\".format(No_of_portion))\n \n \n \n if (Total_to_send==0):\n Each_portion=0\n left_over=0\n else:\n Each_portion=Total_to_send//No_of_portion\n left_over=Total_to_send%No_of_portion\n \n \n print(\"{}\".format(Each_portion))\n print(\"{}\".format(left_over)) \n \n \n for i in range(0, No_of_portion):\n name1 = fin.readline().strip('\\n')\n dict[name1] = dict[name1] + Each_portion\n \n dict[Person_send_out]= dict[Person_send_out] - Total_to_send + left_over\n \n\n \nfor k,v in dict.items(): \n fout.write (k+' ')\n fout.write (str(v)+'\\n')\n print (k,v)\n \nfout.close()\n```\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n参考资料:\n1. https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6\n2. https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/\n3. https://jianpengzhang.github.io/2017/02/26/2017022604/\n4. http://blog.csdn.net/jfkidear/article/details/7532293",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6\",\"https://www.blog.pythonlibrary.org/2017/03/15/python-101-all-about-dictionaries/\",\"https://jianpengzhang.github.io/2017/02/26/2017022604/\",\"http://blog.csdn.net/jfkidear/article/details/7532293\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}2018/01/20 03:23:42
2018/01/20 03:23:42
| required auths | [] |
| required posting auths | ["spearous"] |
| id | follow |
| json | ["follow",{"follower":"spearous","following":"sanzuwu","what":["blog"]}] |
| Transaction Info | Block #19132254/Trx e4fc3e9711d19b885a564caa6b427b346cb39d86 |
View Raw JSON Data
{
"trx_id": "e4fc3e9711d19b885a564caa6b427b346cb39d86",
"block": 19132254,
"trx_in_block": 13,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-20T03:23:42",
"op": [
"custom_json",
{
"required_auths": [],
"required_posting_auths": [
"spearous"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"spearous\",\"following\":\"sanzuwu\",\"what\":[\"blog\"]}]"
}
]
}spearouspublished a new post: python3-usaco-1-2-1-your-ride-is-here2018/01/17 19:16:33
spearouspublished a new post: python3-usaco-1-2-1-your-ride-is-here
2018/01/17 19:16:33
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-usaco-1-2-1-your-ride-is-here |
| title | python3刷USACO题库 1.2.1 Your Ride Is Here |
| body | 这是第一章的第一部分的第一道题目,所以相对来说,是最简单的题目,或者用网站的话叫"Ad hoc problem"。 大体意思就是地球上有很多飞碟(UFOs)迷的组织。当飞碟发出的信号,和该组织的名字经过某种运算之后,是相等的,那么该组织就会被飞碟带去外星(GO),否则就不带(STAY)。这种运算即:名称里的字母按照A=1, B=2...Z=26转换之后,每个字母对应的数字再连乘,乘积模47,就得到结果。比如 飞碟信号 COMETQ,对应数字为3, 15,13,5,20,17,他们的连乘为3*15*13*5*20*17=994500, 取模47(即除以47的余数):994500 mod 47=27, 结果为27 某个组织的名字 HVNGAT,对应数字为8,22,14,7,1,20,他们的连乘为8*22*14*7*1*20=344960 mod 47=27,结果为27 这样这个组织的名字经过运算的结果和飞碟信号经过计算的结果是一样的,所以就输出"GO"到文件ride.out里即可。 测试时,输入文件为ride.in,内含两行,第一行为飞碟信号,第二行为组织的名字。这两组字母的长度不定,也不一定相同。 输出为"GO"(相等)或者"STAY"(不等)。 我的python程序: ``` fin = open ('ride.in', 'r') fout = open ('ride.out', 'w') comet = fin.readline() group = fin.readline() x=1 y=1 for i in range(0,len(comet)): x = x * (ord(comet[i])-64) for i in range(0,len(group)): y = y * (ord(group[i])-64) if ((x%47)==(y%47)): fout.write ("GO" + '\n') else: fout.write ("STAY" + '\n') fout.close() ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19064953/Trx 25fc931ac4defad7915d347dd68f7709a6be362a |
View Raw JSON Data
{
"trx_id": "25fc931ac4defad7915d347dd68f7709a6be362a",
"block": 19064953,
"trx_in_block": 2,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T19:16:33",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-usaco-1-2-1-your-ride-is-here",
"title": "python3刷USACO题库 1.2.1 Your Ride Is Here",
"body": "这是第一章的第一部分的第一道题目,所以相对来说,是最简单的题目,或者用网站的话叫\"Ad hoc problem\"。\n\n大体意思就是地球上有很多飞碟(UFOs)迷的组织。当飞碟发出的信号,和该组织的名字经过某种运算之后,是相等的,那么该组织就会被飞碟带去外星(GO),否则就不带(STAY)。这种运算即:名称里的字母按照A=1, B=2...Z=26转换之后,每个字母对应的数字再连乘,乘积模47,就得到结果。比如\n飞碟信号\nCOMETQ,对应数字为3, 15,13,5,20,17,他们的连乘为3*15*13*5*20*17=994500, 取模47(即除以47的余数):994500 mod 47=27, 结果为27\n\n某个组织的名字\nHVNGAT,对应数字为8,22,14,7,1,20,他们的连乘为8*22*14*7*1*20=344960 mod 47=27,结果为27\n\n这样这个组织的名字经过运算的结果和飞碟信号经过计算的结果是一样的,所以就输出\"GO\"到文件ride.out里即可。\n\n测试时,输入文件为ride.in,内含两行,第一行为飞碟信号,第二行为组织的名字。这两组字母的长度不定,也不一定相同。\n输出为\"GO\"(相等)或者\"STAY\"(不等)。\n\n我的python程序:\n```\nfin = open ('ride.in', 'r')\nfout = open ('ride.out', 'w')\n\ncomet = fin.readline()\ngroup = fin.readline()\n\nx=1\ny=1\n\nfor i in range(0,len(comet)):\n x = x * (ord(comet[i])-64)\n \nfor i in range(0,len(group)):\n y = y * (ord(group[i])-64)\n\n \n \nif ((x%47)==(y%47)):\n fout.write (\"GO\" + '\\n')\nelse:\n fout.write (\"STAY\" + '\\n')\n \nfout.close()\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-usaco-sum-the-numbers-map-list-comprehension2018/01/17 16:29:21
spearouspublished a new post: python3-usaco-sum-the-numbers-map-list-comprehension
2018/01/17 16:29:21
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-usaco-sum-the-numbers-map-list-comprehension |
| title | python3刷USACO题库 Sum the Numbers (map(), list comprehension) |
| body | @@ -1476,12 +1476,161 @@ urn 0;%0A%7D%0A%60%60%60 +%0A%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%EF%BC%9A%0A1. https://www.python-course.eu/python3_lambda.php%0A2. https://stackoverflow.com/questions/1303347/getting-a-map-to-return-a-list-in-python-3-x |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown","links":["https://www.python-course.eu/python3_lambda.php","https://stackoverflow.com/questions/1303347/getting-a-map-to-return-a-list-in-python-3-x"]} |
| Transaction Info | Block #19061609/Trx 1ddf94797920ab40f989513c25f24e04e1bff1c0 |
View Raw JSON Data
{
"trx_id": "1ddf94797920ab40f989513c25f24e04e1bff1c0",
"block": 19061609,
"trx_in_block": 37,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T16:29:21",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-usaco-sum-the-numbers-map-list-comprehension",
"title": "python3刷USACO题库 Sum the Numbers (map(), list comprehension)",
"body": "@@ -1476,12 +1476,161 @@\n urn 0;%0A%7D%0A%60%60%60\n+%0A%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%EF%BC%9A%0A1. https://www.python-course.eu/python3_lambda.php%0A2. https://stackoverflow.com/questions/1303347/getting-a-map-to-return-a-list-in-python-3-x\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"https://www.python-course.eu/python3_lambda.php\",\"https://stackoverflow.com/questions/1303347/getting-a-map-to-return-a-list-in-python-3-x\"]}"
}
]
}rosseyupvoted (100.00%) @spearous / python3-usaco-sum-the-numbers-map-list-comprehension2018/01/17 16:28:24
rosseyupvoted (100.00%) @spearous / python3-usaco-sum-the-numbers-map-list-comprehension
2018/01/17 16:28:24
| voter | rossey |
| author | spearous |
| permlink | python3-usaco-sum-the-numbers-map-list-comprehension |
| weight | 10000 (100.00%) |
| Transaction Info | Block #19061590/Trx c5256f7143e239a54e203cee373abf4484361fa9 |
View Raw JSON Data
{
"trx_id": "c5256f7143e239a54e203cee373abf4484361fa9",
"block": 19061590,
"trx_in_block": 49,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T16:28:24",
"op": [
"vote",
{
"voter": "rossey",
"author": "spearous",
"permlink": "python3-usaco-sum-the-numbers-map-list-comprehension",
"weight": 10000
}
]
}spearouspublished a new post: python3-usaco-sum-the-numbers-map-list-comprehension2018/01/17 16:28:15
spearouspublished a new post: python3-usaco-sum-the-numbers-map-list-comprehension
2018/01/17 16:28:15
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-usaco-sum-the-numbers-map-list-comprehension |
| title | python3刷USACO题库 Sum the Numbers (map(), list comprehension) |
| body | USACO是美国计算机奥林匹克竞赛在线题库,提供了一个从零开始入门的系列题目,分为6个章节,每章节有4-5个部分。每个章节里的题目集中于一种算法的训练。你只有完成了前面的题目,后面的题目才会开放给你。另外,不同于其他OJ,USACO是从文件中读取输入,所以我们在编写代码的时候,要注意从文件中读取数据而不是控制台。同时在提交代码的时候,需要在代码最前面加上 你的ID: /* ID:帐号 PROG:做的题的名字 LANG:C++ */ 这些都和正式的ACM比赛很一致。 Sum the Numbers是最开始的用于测试递交系统的题目。他给你一个源代码,你需要学会在这份源代码前面加上如上所述的题头,然后使用网页的上传按钮递交答案。 这个题目本身很简单,和TK的前1000-1010类似: 输入是一行两个用空格隔开的整数,从test.in文件中读取; 输出是如山两个整数的和,写入test.out文件。 题目给出的python3代码为 ``` fin = open ('test.in', 'r') fout = open ('test.out', 'w') x,y = map(int, fin.readline().split()) sum = x+y fout.write (str(sum) + '\n') fout.close() ``` 其中map()的用处:x,y需要把输入转换为int形式才能做计算。而fin.readline().split()返回一个列表,但int()类型转换不支持列表。所以需要一个遍历列表的命令,即list comprehension: ``` x, y = [int(a) for a in fin.readline().split()] ``` map()的作用类似上述命令,它有两个参数,第一个参数为一个操作,第二个为一个序列,比如列表。map()的作用就是把第一个操作应用于后一个列表。 附C和C++代码: ``` /* ID: your_id_here LANG: C TASK: test */ #include <stdio.h> main () { FILE *fin = fopen ("test.in", "r"); FILE *fout = fopen ("test.out", "w"); int a, b; fscanf (fin, "%d %d", &a, &b); /* the two input integers */ fprintf (fout, "%d\n", a+b); exit (0); } ``` ``` /* ID: your_id_here TASK: test LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include <iostream> #include <fstream> #include <string> using namespace std; int main() { ofstream fout ("test.out"); ifstream fin ("test.in"); int a, b; fin >> a >> b; fout << a+b << endl; return 0; } ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19061587/Trx d8949b9d3c0c9fae1d22e744c97a21e7182a8ab1 |
View Raw JSON Data
{
"trx_id": "d8949b9d3c0c9fae1d22e744c97a21e7182a8ab1",
"block": 19061587,
"trx_in_block": 1,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T16:28:15",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-usaco-sum-the-numbers-map-list-comprehension",
"title": "python3刷USACO题库 Sum the Numbers (map(), list comprehension)",
"body": "USACO是美国计算机奥林匹克竞赛在线题库,提供了一个从零开始入门的系列题目,分为6个章节,每章节有4-5个部分。每个章节里的题目集中于一种算法的训练。你只有完成了前面的题目,后面的题目才会开放给你。另外,不同于其他OJ,USACO是从文件中读取输入,所以我们在编写代码的时候,要注意从文件中读取数据而不是控制台。同时在提交代码的时候,需要在代码最前面加上 你的ID:\n/* \nID:帐号 \nPROG:做的题的名字 \nLANG:C++ \n*/\n这些都和正式的ACM比赛很一致。\n\nSum the Numbers是最开始的用于测试递交系统的题目。他给你一个源代码,你需要学会在这份源代码前面加上如上所述的题头,然后使用网页的上传按钮递交答案。\n\n这个题目本身很简单,和TK的前1000-1010类似:\n输入是一行两个用空格隔开的整数,从test.in文件中读取;\n输出是如山两个整数的和,写入test.out文件。\n\n题目给出的python3代码为\n```\nfin = open ('test.in', 'r')\nfout = open ('test.out', 'w')\nx,y = map(int, fin.readline().split())\nsum = x+y\nfout.write (str(sum) + '\\n')\nfout.close()\n```\n其中map()的用处:x,y需要把输入转换为int形式才能做计算。而fin.readline().split()返回一个列表,但int()类型转换不支持列表。所以需要一个遍历列表的命令,即list comprehension:\n```\nx, y = [int(a) for a in fin.readline().split()]\n```\nmap()的作用类似上述命令,它有两个参数,第一个参数为一个操作,第二个为一个序列,比如列表。map()的作用就是把第一个操作应用于后一个列表。\n\n附C和C++代码:\n```\n/*\nID: your_id_here\nLANG: C\nTASK: test\n*/\n#include <stdio.h>\nmain () {\n FILE *fin = fopen (\"test.in\", \"r\");\n FILE *fout = fopen (\"test.out\", \"w\");\n int a, b;\n fscanf (fin, \"%d %d\", &a, &b);\t/* the two input integers */\n fprintf (fout, \"%d\\n\", a+b);\n exit (0);\n}\n```\n\n\n```\n/*\nID: your_id_here\nTASK: test\nLANG: C++ \n*/\n/* LANG can be C++11 or C++14 for those more recent releases */\n#include <iostream>\n#include <fstream>\n#include <string>\n\nusing namespace std;\n\nint main() {\n ofstream fout (\"test.out\");\n ifstream fin (\"test.in\");\n int a, b;\n fin >> a >> b;\n fout << a+b << endl;\n return 0;\n}\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-1012-find-min-and-or-max2018/01/17 15:29:36
spearouspublished a new post: python3-tk-1012-find-min-and-or-max
2018/01/17 15:29:36
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1012-find-min-and-or-max |
| title | python3刷TK题库 1012: 外币兑换(求最值,find min and/or max) |
| body | 这算是第一个涉及一个比较重要的算法的题目。这一类题目会要求你给出一个数组中的最值,即给出最大值或最小值或两个都要求给出。如果延伸一下,还可以求前n个最大值和前n个最小值。因此这是一个很基础的算法。首先看一下理论结果,然后看一下有没有什么python库函数可以直接调用,最后看一下求前n个最值的方法。 ## 理论上讲 你想找出最大值最小值,至少要遍历一遍所有的数字才可以。这样,时间复杂度就是O(N),不可能再优化。然后是比较次数的问题。如果找一次最大值遍历一次,再找一次最小值再遍历一次,一共是2N次比较。然后如果想改进比较次数,那么就要从能否把这两次遍历合二为一入手。结果当然是可以。最佳比较次数是(3/2)N。对于最佳比较次数,我们可以这么想: 首先把所有数字分成2个一组的形式,这样一共有N/2组。然后在组内有a和b两个数,另有max和min做临时变量,那么可以这样操作: 1 比较a和b (假设a>b) 2 比较a和max,如果a>max,那么a是最大值,更新max;否则max是最大值; 3 比较b和min,如果b<min, 那么b是最小值,更新min;否则min是最小值; 这样在每个组内找出最大和最小值需要3次比较,所以整体上需要(3/2)N次比较。 ## python3库函数 在python3标准库中,提供了一些函数调用,可以用来找出一组数(list)中的最值。 ``` c = [-10,-5,0,5,3,10,15,-20,25] print (min(c)) #返回最小值 print (max(c)) #返回最大值 print (c.index(min(c))) # 返回最小值的位置 print (c.index(max(c))) # 返回最大值的位置 ``` 对于字典的求最值也可以用max()和min(),可以参见参考文献5,6. ## 求前n个最值 如果只是调用python3库函数的话,可以直接使用heapq模块里的nlargest()和nsmallest()。比如: ``` import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, nums)) # Prints [42, 37, 23] print(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2] ``` 当然,他们也可以取出某个复杂数据结构中的某一个成员的最大或者最小值,只需要指定是哪个成员。比如: ``` portfolio = [ {'name': 'IBM', 'shares': 100, 'price': 91.1}, {'name': 'AAPL', 'shares': 50, 'price': 543.22}, {'name': 'FB', 'shares': 200, 'price': 21.09}, {'name': 'HPQ', 'shares': 35, 'price': 31.75}, {'name': 'YHOO', 'shares': 45, 'price': 16.35}, {'name': 'ACME', 'shares': 75, 'price': 115.65} ] cheap = heapq.nsmallest(3, portfolio, key=lambda s: s['price']) expensive = heapq.nlargest(3, portfolio, key=lambda s: s['price']) ``` 对于这两个函数,在库里是通过堆排序来实现的。 我们需要根据不同的场合来选用合适的函数。比如,如果只要求取出最大或者最小,则min()或者max()是比较好用的;或者如果需要取出前k个数值,并且k比总量小,那么nlargest()或者nsmallest()是比较好用的;而当k接近总量时,直接排序再使用切片来取用前k个,是比较好用的: ``` sorted(items)[:N] sorted(items)[-N:] ``` http://tk.hustoj.com/problem.php?id=1012 1012: 外币兑换 时间限制: 1 Sec 内存限制: 32 MB 提交: 2683 解决: 1790 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 小明刚从美国回来,发现手上还有一些未用完的美金,于是想去银行兑换成人民币。可是听说最近人民币将会升值,并从金融机构得到了接下来十二个月可能的美元对人民币汇率,现在,小明想要在接下来一年中把美金都兑换成人民币,请问最多能得到多少人民币? 输入 输入的第一行是一个实数N(1.00<=N<=100.00),表示小明现有的美金数量。 接下来一行,包含12个实数ai,表示接下来十二个月的美元对人民币汇率。 输出 输出一个小数R,表示小明最多能获得的人民币数量,结果保留两位小数。 样例输入 46.91 6.31 6.32 6.61 6.65 5.55 5.63 6.82 6.42 6.40 5.62 6.78 5.60 样例输出 319.93 我的python3程序应该是没错的,但一直不能通过,因此列在这里作参考而已: ``` dollar=float(input()) if (dollar >= 1 and dollar =< 100): US_to_CN=input() for i in range(0,12): ratio.append(float(US_to_CN.split(' ')[i])) print("{:.2f}".format(max(ratio)*dollar)) ``` 参考资料: 1. https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons 2. http://blog.csdn.net/cyp331203/article/details/43148987 3. http://blog.csdn.net/ns_code/article/details/28735533 4. http://blog.csdn.net/ns_code/article/details/26966159 5. http://zoeyyoung.github.io/python-dict-list-min-max-value.html 6. https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1012","https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons","http://blog.csdn.net/cyp331203/article/details/43148987","http://blog.csdn.net/ns_code/article/details/28735533","http://blog.csdn.net/ns_code/article/details/26966159","http://zoeyyoung.github.io/python-dict-list-min-max-value.html","https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19060414/Trx 3bb858b4413556ed1bf9916590bc0e47010e9e5b |
View Raw JSON Data
{
"trx_id": "3bb858b4413556ed1bf9916590bc0e47010e9e5b",
"block": 19060414,
"trx_in_block": 30,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T15:29:36",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1012-find-min-and-or-max",
"title": "python3刷TK题库 1012: 外币兑换(求最值,find min and/or max)",
"body": "这算是第一个涉及一个比较重要的算法的题目。这一类题目会要求你给出一个数组中的最值,即给出最大值或最小值或两个都要求给出。如果延伸一下,还可以求前n个最大值和前n个最小值。因此这是一个很基础的算法。首先看一下理论结果,然后看一下有没有什么python库函数可以直接调用,最后看一下求前n个最值的方法。\n\n## 理论上讲\n你想找出最大值最小值,至少要遍历一遍所有的数字才可以。这样,时间复杂度就是O(N),不可能再优化。然后是比较次数的问题。如果找一次最大值遍历一次,再找一次最小值再遍历一次,一共是2N次比较。然后如果想改进比较次数,那么就要从能否把这两次遍历合二为一入手。结果当然是可以。最佳比较次数是(3/2)N。对于最佳比较次数,我们可以这么想:\n首先把所有数字分成2个一组的形式,这样一共有N/2组。然后在组内有a和b两个数,另有max和min做临时变量,那么可以这样操作:\n1 比较a和b (假设a>b)\n2 比较a和max,如果a>max,那么a是最大值,更新max;否则max是最大值;\n3 比较b和min,如果b<min, 那么b是最小值,更新min;否则min是最小值;\n这样在每个组内找出最大和最小值需要3次比较,所以整体上需要(3/2)N次比较。\n\n## python3库函数\n在python3标准库中,提供了一些函数调用,可以用来找出一组数(list)中的最值。\n\n```\nc = [-10,-5,0,5,3,10,15,-20,25]\n\nprint (min(c)) #返回最小值\nprint (max(c)) #返回最大值\nprint (c.index(min(c))) # 返回最小值的位置\nprint (c.index(max(c))) # 返回最大值的位置\n```\n\n对于字典的求最值也可以用max()和min(),可以参见参考文献5,6.\n\n\n## 求前n个最值\n如果只是调用python3库函数的话,可以直接使用heapq模块里的nlargest()和nsmallest()。比如:\n```\nimport heapq\nnums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2]\nprint(heapq.nlargest(3, nums)) # Prints [42, 37, 23]\nprint(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2]\n```\n\n当然,他们也可以取出某个复杂数据结构中的某一个成员的最大或者最小值,只需要指定是哪个成员。比如:\n\n```\nportfolio = [\n {'name': 'IBM', 'shares': 100, 'price': 91.1},\n {'name': 'AAPL', 'shares': 50, 'price': 543.22},\n {'name': 'FB', 'shares': 200, 'price': 21.09},\n {'name': 'HPQ', 'shares': 35, 'price': 31.75},\n {'name': 'YHOO', 'shares': 45, 'price': 16.35},\n {'name': 'ACME', 'shares': 75, 'price': 115.65}\n]\ncheap = heapq.nsmallest(3, portfolio, key=lambda s: s['price'])\nexpensive = heapq.nlargest(3, portfolio, key=lambda s: s['price'])\n```\n对于这两个函数,在库里是通过堆排序来实现的。\n我们需要根据不同的场合来选用合适的函数。比如,如果只要求取出最大或者最小,则min()或者max()是比较好用的;或者如果需要取出前k个数值,并且k比总量小,那么nlargest()或者nsmallest()是比较好用的;而当k接近总量时,直接排序再使用切片来取用前k个,是比较好用的:\n\n```\nsorted(items)[:N]\nsorted(items)[-N:]\n```\n\nhttp://tk.hustoj.com/problem.php?id=1012\n\n1012: 外币兑换\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 2683 解决: 1790\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n小明刚从美国回来,发现手上还有一些未用完的美金,于是想去银行兑换成人民币。可是听说最近人民币将会升值,并从金融机构得到了接下来十二个月可能的美元对人民币汇率,现在,小明想要在接下来一年中把美金都兑换成人民币,请问最多能得到多少人民币?\n输入\n输入的第一行是一个实数N(1.00<=N<=100.00),表示小明现有的美金数量。\n接下来一行,包含12个实数ai,表示接下来十二个月的美元对人民币汇率。\n输出\n输出一个小数R,表示小明最多能获得的人民币数量,结果保留两位小数。\n样例输入\n46.91\n6.31 6.32 6.61 6.65 5.55 5.63 6.82 6.42 6.40 5.62 6.78 5.60\n样例输出\n319.93\n\n我的python3程序应该是没错的,但一直不能通过,因此列在这里作参考而已:\n\n```\ndollar=float(input())\nif (dollar >= 1 and dollar =< 100):\n US_to_CN=input()\n for i in range(0,12):\n ratio.append(float(US_to_CN.split(' ')[i]))\n print(\"{:.2f}\".format(max(ratio)*dollar))\n```\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n参考资料:\n1. https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons\n2. http://blog.csdn.net/cyp331203/article/details/43148987\n3. http://blog.csdn.net/ns_code/article/details/28735533\n4. http://blog.csdn.net/ns_code/article/details/26966159\n5. http://zoeyyoung.github.io/python-dict-list-min-max-value.html\n6. https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1012\",\"https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons\",\"http://blog.csdn.net/cyp331203/article/details/43148987\",\"http://blog.csdn.net/ns_code/article/details/28735533\",\"http://blog.csdn.net/ns_code/article/details/26966159\",\"http://zoeyyoung.github.io/python-dict-list-min-max-value.html\",\"https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-1012-find-min-and-or-max2018/01/17 05:56:39
spearouspublished a new post: python3-tk-1012-find-min-and-or-max
2018/01/17 05:56:39
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1012-find-min-and-or-max |
| title | python3刷TK题库 1012: 外币兑换(求最值,find min and/or max) |
| body | 这算是第一个涉及一个比较重要的算法的题目。这一类题目会要求你给出一个数组中的最值,即给出最大值或最小值或两个都要求给出。如果延伸一下,还可以求前n个最大值和前n个最小值。因此这是一个很基础的算法。首先看一下理论结果,然后看一下有没有什么python库函数可以直接调用,最后看一下求前n个最值的方法。 ## 理论上讲 你想找出最大值最小值,至少要遍历一遍所有的数字才可以。这样,时间复杂度就是O(N),不可能再优化。然后是比较次数的问题。如果找一次最大值遍历一次,再找一次最小值再遍历一次,一共是2N次比较。然后如果想改进比较次数,那么就要从能否把这两次遍历合二为一入手。结果当然是可以。最佳比较次数是(3/2)N。对于最佳比较次数,我们可以这么想: 首先把所有数字分成2个一组的形式,这样一共有N/2组。然后在组内有a和b两个数,另有max和min做临时变量,那么可以这样操作: 1 比较a和b (假设a>b) 2 比较a和max,如果a>max,那么a是最大值,更新max;否则max是最大值; 3 比较b和min,如果b<min, 那么b是最小值,更新min;否则min是最小值; 这样在每个组内找出最大和最小值需要3次比较,所以整体上需要(3/2)N次比较。 ## python3库函数 在python3标准库中,提供了一些函数调用,可以用来找出一组数(list)中的最值。 ``` c = [-10,-5,0,5,3,10,15,-20,25] print (min(c)) #返回最小值 print (max(c)) #返回最大值 print (c.index(min(c))) # 返回最小值的位置 print (c.index(max(c))) # 返回最大值的位置 ``` 对于字典的求最值也可以用max()和min(),可以参见参考文献5,6. ## 求前n个最值 参考资料: 1. https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons 2. http://blog.csdn.net/cyp331203/article/details/43148987 3. http://blog.csdn.net/ns_code/article/details/28735533 4. http://blog.csdn.net/ns_code/article/details/26966159 5. http://zoeyyoung.github.io/python-dict-list-min-max-value.html 6. https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons","http://blog.csdn.net/cyp331203/article/details/43148987","http://blog.csdn.net/ns_code/article/details/28735533","http://blog.csdn.net/ns_code/article/details/26966159","http://zoeyyoung.github.io/python-dict-list-min-max-value.html","https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19048957/Trx 6fde0acae2096c0bfeb48fdbc315a2db6f247872 |
View Raw JSON Data
{
"trx_id": "6fde0acae2096c0bfeb48fdbc315a2db6f247872",
"block": 19048957,
"trx_in_block": 35,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T05:56:39",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1012-find-min-and-or-max",
"title": "python3刷TK题库 1012: 外币兑换(求最值,find min and/or max)",
"body": "这算是第一个涉及一个比较重要的算法的题目。这一类题目会要求你给出一个数组中的最值,即给出最大值或最小值或两个都要求给出。如果延伸一下,还可以求前n个最大值和前n个最小值。因此这是一个很基础的算法。首先看一下理论结果,然后看一下有没有什么python库函数可以直接调用,最后看一下求前n个最值的方法。\n\n## 理论上讲\n你想找出最大值最小值,至少要遍历一遍所有的数字才可以。这样,时间复杂度就是O(N),不可能再优化。然后是比较次数的问题。如果找一次最大值遍历一次,再找一次最小值再遍历一次,一共是2N次比较。然后如果想改进比较次数,那么就要从能否把这两次遍历合二为一入手。结果当然是可以。最佳比较次数是(3/2)N。对于最佳比较次数,我们可以这么想:\n首先把所有数字分成2个一组的形式,这样一共有N/2组。然后在组内有a和b两个数,另有max和min做临时变量,那么可以这样操作:\n1 比较a和b (假设a>b)\n2 比较a和max,如果a>max,那么a是最大值,更新max;否则max是最大值;\n3 比较b和min,如果b<min, 那么b是最小值,更新min;否则min是最小值;\n这样在每个组内找出最大和最小值需要3次比较,所以整体上需要(3/2)N次比较。\n\n## python3库函数\n在python3标准库中,提供了一些函数调用,可以用来找出一组数(list)中的最值。\n\n```\nc = [-10,-5,0,5,3,10,15,-20,25]\n\nprint (min(c)) #返回最小值\nprint (max(c)) #返回最大值\nprint (c.index(min(c))) # 返回最小值的位置\nprint (c.index(max(c))) # 返回最大值的位置\n```\n\n对于字典的求最值也可以用max()和min(),可以参见参考文献5,6.\n\n\n## 求前n个最值\n\n\n\n\n\n\n\n\n\n参考资料:\n1. https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons\n2. http://blog.csdn.net/cyp331203/article/details/43148987\n3. http://blog.csdn.net/ns_code/article/details/28735533\n4. http://blog.csdn.net/ns_code/article/details/26966159\n5. http://zoeyyoung.github.io/python-dict-list-min-max-value.html\n6. https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons\",\"http://blog.csdn.net/cyp331203/article/details/43148987\",\"http://blog.csdn.net/ns_code/article/details/28735533\",\"http://blog.csdn.net/ns_code/article/details/26966159\",\"http://zoeyyoung.github.io/python-dict-list-min-max-value.html\",\"https://stackoverflow.com/questions/5320871/in-list-of-dicts-find-min-value-of-a-common-dict-field\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}alanzhengupvoted (2.00%) @spearous / python3-tk-10112018/01/17 03:14:57
alanzhengupvoted (2.00%) @spearous / python3-tk-1011
2018/01/17 03:14:57
| voter | alanzheng |
| author | spearous |
| permlink | python3-tk-1011 |
| weight | 200 (2.00%) |
| Transaction Info | Block #19045723/Trx 019f9af784dd4fabba3a4e6e81d06fa427fe7e42 |
View Raw JSON Data
{
"trx_id": "019f9af784dd4fabba3a4e6e81d06fa427fe7e42",
"block": 19045723,
"trx_in_block": 18,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T03:14:57",
"op": [
"vote",
{
"voter": "alanzheng",
"author": "spearous",
"permlink": "python3-tk-1011",
"weight": 200
}
]
}spearouspublished a new post: python3-tk-10112018/01/17 01:31:06
spearouspublished a new post: python3-tk-1011
2018/01/17 01:31:06
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1011 |
| title | python3刷TK题库 1011: 软件版本 |
| body | 这又是多重判断选择问题,算是练一练条件判断的使用吧。python3有几种条件判断格式语句,并且可以嵌套: ``` if statement1: #outer if print("hello world") if nested_statement1: #first nested if print("yes") elif nested_statement2: #first nested elif print("maybe") else: #first nested else print("no") elif statement2: #outer elif print("hello galaxy") if nested_statement3: #second nested if print("yes") elif nested_statement4: #second nested elif print("maybe") else: #second nested else print("no") else: #outer else statement("hello universe") ``` 而逻辑关系运算符有: |Operator |What it means| |---------------|--------------------------------| |== |Equal to| |!= |Not equal to| |< |Less than| |> |Greater than| |<= |Less than or equal to| |>= |Greater than or equal to| |and | True only if both are true| |or |True if at least one is true| |not | True only if false| http://tk.hustoj.com/problem.php?id=1011 1011: 软件版本 时间限制: 1 Sec 内存限制: 32 MB 提交: 3321 解决: 1561 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 相信大家一定有过在网上下载软件而碰到多个不同版本的情况。一般来说,软件的版本号由三个部分组成,主版本号(Major Version Number),子版本号(Minor Version Number)和修订号(Revision_Number)。当软件进行了重大的修改时,主版本号加一;当软件在原有基础上增加部分功能时,主版本号不变,子版本号加一;当软件仅仅修正了部分bug时,主版本号和子版本号都不变,修正号加一。 在我们比较软件的两个版本的新旧时,都是先比较主版本号,当主版本号相同时再比较子版本号,前两者都相同的情况下再比较修正号。版本号越大的软件越新。 现在,小明在下载软件的时候碰到了两个版本,请你告诉他哪个版本更新一些。 输入 输入的第一行有一个整数T,代表有T组测试。接下来有T组测试。 每组测试分两行,第一行有三个整数代表第一个软件版本的主版本号,子版本号和修订号。第二行也有三个整数代表第二个软件版本的主版本号,子版本号和修订号。 数据中出现的整数都在[0,1000]范围之内。 输出 对于每组测试,如果第一个软件的版本新点,请输出First,如果第二个软件的版本新点,请输出Second,否则输出Same。 样例输入 3 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 样例输出 Second First Same 我的python3程序: ``` Number_of_test=int(input()) for i in range(0,Number_of_test): data_of_first=input() data_of_second=input() if data_of_first.split()[0] > data_of_second.split()[0]: print("First") elif data_of_first.split()[0] < data_of_second.split()[0]: print("Second") elif data_of_first.split()[0] == data_of_second.split()[0]: if data_of_first.split()[1] > data_of_second.split()[1]: print("First") elif data_of_first.split()[1] < data_of_second.split()[1]: print("Second") elif data_of_first.split()[1] == data_of_second.split()[1]: if data_of_first.split()[2] > data_of_second.split()[2]: print("First") elif data_of_first.split()[2] < data_of_second.split()[2]: print("Second") elif data_of_first.split()[2] == data_of_second.split()[2]: print("Same") ``` C ``` #include<stdio.h>//用数组做也行 main() { int t; int a[3],b[3]; int i; scanf("%d",&t); while(t--) { scanf("%d%d%d",&a[0],&a[1],&a[2]); scanf("%d%d%d",&b[0],&b[1],&b[2]); for(i=0;i<3;i++) { if(a[i]>b[i]) { printf("First\n"); break; } else { if(a[i]<b[i]) { printf("Second\n"); break; } } } if(i==3) printf("Same\n"); } } ``` C++ ``` #include <iostream> using namespace std; int main() { int n; cin>>n; while(n--) { int a[6]; for(int i=0;i<6;++i) { cin>>a[i]; } if(a[0]<a[3] || ((a[0]==a[3]) && (a[1]<a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]<a[5]))) cout<<"Second"<<endl; else if(a[0]>a[3] || ((a[0]==a[3]) && (a[1]>a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]>a[5]))) cout<<"First"<<endl; else cout<<"Same"<<endl; } return 0; } ``` 参考资料: 1. https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2 2. https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3 3. http://www.tk4479.net/u013041792/article/details/17123883 4. http://blog.csdn.net/AdamChinaren/article/details/18925505 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1011","https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2","https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3","http://www.tk4479.net/u013041792/article/details/17123883","http://blog.csdn.net/AdamChinaren/article/details/18925505"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19043647/Trx 982c3dc6ade5371a4fa46a0f9af2d2da3aa3c113 |
View Raw JSON Data
{
"trx_id": "982c3dc6ade5371a4fa46a0f9af2d2da3aa3c113",
"block": 19043647,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T01:31:06",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1011",
"title": "python3刷TK题库 1011: 软件版本",
"body": "这又是多重判断选择问题,算是练一练条件判断的使用吧。python3有几种条件判断格式语句,并且可以嵌套:\n\n```\nif statement1: #outer if \n print(\"hello world\")\n\n if nested_statement1: #first nested if \n print(\"yes\")\n\n elif nested_statement2: #first nested elif\n print(\"maybe\")\n\n else: #first nested else\n print(\"no\")\n\nelif statement2: #outer elif\n print(\"hello galaxy\")\n\n if nested_statement3: #second nested if\n print(\"yes\")\n\n elif nested_statement4: #second nested elif\n print(\"maybe\")\n\n else: #second nested else\n print(\"no\")\n\nelse: #outer else\n statement(\"hello universe\")\n```\n\n而逻辑关系运算符有:\n\n\n|Operator\t|What it means|\n|---------------|--------------------------------|\n|==\t |Equal to|\n|!=\t |Not equal to|\n|<\t |Less than|\n|>\t |Greater than|\n|<=\t |Less than or equal to|\n|>=\t |Greater than or equal to|\n|and | True only if both are true|\n|or |True if at least one is true|\n|not | True only if false|\n\n\nhttp://tk.hustoj.com/problem.php?id=1011\n\n1011: 软件版本\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 3321 解决: 1561\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n相信大家一定有过在网上下载软件而碰到多个不同版本的情况。一般来说,软件的版本号由三个部分组成,主版本号(Major Version Number),子版本号(Minor Version Number)和修订号(Revision_Number)。当软件进行了重大的修改时,主版本号加一;当软件在原有基础上增加部分功能时,主版本号不变,子版本号加一;当软件仅仅修正了部分bug时,主版本号和子版本号都不变,修正号加一。\n在我们比较软件的两个版本的新旧时,都是先比较主版本号,当主版本号相同时再比较子版本号,前两者都相同的情况下再比较修正号。版本号越大的软件越新。\n现在,小明在下载软件的时候碰到了两个版本,请你告诉他哪个版本更新一些。\n输入\n输入的第一行有一个整数T,代表有T组测试。接下来有T组测试。\n每组测试分两行,第一行有三个整数代表第一个软件版本的主版本号,子版本号和修订号。第二行也有三个整数代表第二个软件版本的主版本号,子版本号和修订号。\n数据中出现的整数都在[0,1000]范围之内。\n输出\n对于每组测试,如果第一个软件的版本新点,请输出First,如果第二个软件的版本新点,请输出Second,否则输出Same。\n样例输入\n3\n1 1 0\n1 1 1\n1 1 1\n1 1 0\n1 1 1\n1 1 1\n样例输出\nSecond\nFirst\nSame\n\n\n我的python3程序:\n```\nNumber_of_test=int(input())\nfor i in range(0,Number_of_test):\n data_of_first=input()\n data_of_second=input()\n if data_of_first.split()[0] > data_of_second.split()[0]:\n print(\"First\")\n elif data_of_first.split()[0] < data_of_second.split()[0]:\n print(\"Second\")\n elif data_of_first.split()[0] == data_of_second.split()[0]:\n if data_of_first.split()[1] > data_of_second.split()[1]:\n print(\"First\")\n elif data_of_first.split()[1] < data_of_second.split()[1]:\n print(\"Second\")\n elif data_of_first.split()[1] == data_of_second.split()[1]:\n if data_of_first.split()[2] > data_of_second.split()[2]:\n print(\"First\")\n elif data_of_first.split()[2] < data_of_second.split()[2]:\n print(\"Second\")\n elif data_of_first.split()[2] == data_of_second.split()[2]:\n print(\"Same\")\n```\n\nC\n```\n#include<stdio.h>//用数组做也行\nmain()\n{\n int t;\n int a[3],b[3];\n int i;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d%d%d\",&a[0],&a[1],&a[2]);\n scanf(\"%d%d%d\",&b[0],&b[1],&b[2]);\n for(i=0;i<3;i++)\n {\n if(a[i]>b[i])\n {\n printf(\"First\\n\");\n break;\n }\n else\n {\n if(a[i]<b[i])\n {\n printf(\"Second\\n\");\n break;\n }\n }\n }\n if(i==3)\n printf(\"Same\\n\");\n }\n}\n```\n\nC++\n```\n#include <iostream> \n \nusing namespace std; \n \nint main() \n{ \n int n; \n cin>>n; \n while(n--) \n { \n int a[6]; \n for(int i=0;i<6;++i) \n { \n cin>>a[i]; \n } \n if(a[0]<a[3] || ((a[0]==a[3]) && (a[1]<a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]<a[5]))) \n cout<<\"Second\"<<endl; \n else if(a[0]>a[3] || ((a[0]==a[3]) && (a[1]>a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]>a[5]))) \n cout<<\"First\"<<endl; \n else \n cout<<\"Same\"<<endl; \n } \n return 0; \n} \n```\n\n\n参考资料:\n1. https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2\n2. https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3\n3. http://www.tk4479.net/u013041792/article/details/17123883\n4. http://blog.csdn.net/AdamChinaren/article/details/18925505",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1011\",\"https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2\",\"https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3\",\"http://www.tk4479.net/u013041792/article/details/17123883\",\"http://blog.csdn.net/AdamChinaren/article/details/18925505\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-10102018/01/17 01:15:24
spearouspublished a new post: python3-tk-1010
2018/01/17 01:15:24
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1010 |
| title | python3刷TK题库 1010: 平均绩点 |
| body | 仍然是语言基础问题,这次主要是选择结构的使用。和C/C++不一样的是,python没有switch...case结构,所以遇到多种情况的选择,一般要么用很多if,要么用python特有的数据结构--字典。我的实现使用很多if。如果想要pythonic一点,那肯定是用字典了。当然,也有用python的函数自己实现一个switch...case结构的。 1010: 平均绩点 时间限制: 1 Sec 内存限制: 32 MB 提交: 5803 解决: 1850 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 每门课的成绩分为A、B、C、D、F五个等级,为了计算平均绩点,规定A、B、C、D、F分别代表4分、3分、2分、1分、0分。 输入 有多组测试样例。每组输入数据占一行,由一个或多个大写字母组成,字母之间由空格分隔。 输出 每组输出结果占一行。如果输入的大写字母都在集合{A,B,C,D,F}中,则输出对应的平均绩点,结果保留两位小数。否则,输出“Unknown”。 样例输入 A B C D F B F F C C A D C E F 样例输出 2.00 1.83 Unknown 我的python3程序: ``` while True: total=0 Grade_in_letter=input() No_of_input=len(Grade_in_letter.split(' ')) for i in range(0, No_of_input): if (Grade_in_letter.split(' ')[i]=='A'): total=total+4 elif (Grade_in_letter.split(' ')[i]=='B'): total=total+3 elif (Grade_in_letter.split(' ')[i]=='C'): total=total+2 elif (Grade_in_letter.split(' ')[i]=='D'): total=total+1 elif (Grade_in_letter.split(' ')[i]=='F'): total=total+0 else: total=-1 break average=total/No_of_input if(average >= 0): print("{:.2f}".format(average)) if(average < 0): print("Unknown") ``` 附一个C(http://blog.csdn.net/sinat_37765046/article/details/74787247) ``` #include <stdio.h> #include <string.h> int main() { char a[100]; int i,n,flag; double sum;//浮点数都设置为double while(gets(a))//注意输入有空格,scanf遇到空格就退出,用gets { flag=1; sum=n=0;//sum统计字符对应的和,n统计字符个数 for(i=0;i<strlen(a);i+=2)//遇到空格跳过,故计数器为i+=2 { if(a[i]=='A') sum+=4,n++;求平均数->求和+求个数 else if(a[i]=='B') sum+=3,n++; else if(a[i]=='C') sum+=2,n++; else if(a[i]=='D') sum+=1,n++; else if(a[i]=='F') n++; else flag=0;//标志变量记录有无非法输入 } if(flag) { printf("%.2f\n",sum/n); } else { printf("Unknown\n"); } n=0; sum=0; flag=1;//多次输入,所以计数器n,总和sum,标志变量flag都要复位 } } ``` 参考资料: 1. https://www.pydanny.com/why-doesnt-python-have-switch-case.html 2. http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://blog.csdn.net/sinat_37765046/article/details/74787247","https://www.pydanny.com/why-doesnt-python-have-switch-case.html","http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19043333/Trx e299137c13eeb5369ea04388de3211d1c9a4f7e0 |
View Raw JSON Data
{
"trx_id": "e299137c13eeb5369ea04388de3211d1c9a4f7e0",
"block": 19043333,
"trx_in_block": 12,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T01:15:24",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1010",
"title": "python3刷TK题库 1010: 平均绩点",
"body": "仍然是语言基础问题,这次主要是选择结构的使用。和C/C++不一样的是,python没有switch...case结构,所以遇到多种情况的选择,一般要么用很多if,要么用python特有的数据结构--字典。我的实现使用很多if。如果想要pythonic一点,那肯定是用字典了。当然,也有用python的函数自己实现一个switch...case结构的。\n\n1010: 平均绩点\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 5803 解决: 1850\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n每门课的成绩分为A、B、C、D、F五个等级,为了计算平均绩点,规定A、B、C、D、F分别代表4分、3分、2分、1分、0分。\n输入\n有多组测试样例。每组输入数据占一行,由一个或多个大写字母组成,字母之间由空格分隔。\n输出\n每组输出结果占一行。如果输入的大写字母都在集合{A,B,C,D,F}中,则输出对应的平均绩点,结果保留两位小数。否则,输出“Unknown”。\n样例输入\nA B C D F\nB F F C C A\nD C E F\n样例输出\n2.00\n1.83\nUnknown\n\n我的python3程序:\n```\nwhile True:\n total=0\n Grade_in_letter=input()\n No_of_input=len(Grade_in_letter.split(' '))\n for i in range(0, No_of_input):\n if (Grade_in_letter.split(' ')[i]=='A'):\n total=total+4\n elif (Grade_in_letter.split(' ')[i]=='B'):\n total=total+3\n elif (Grade_in_letter.split(' ')[i]=='C'):\n total=total+2\n elif (Grade_in_letter.split(' ')[i]=='D'):\n total=total+1\n elif (Grade_in_letter.split(' ')[i]=='F'):\n total=total+0 \n else:\n total=-1\n break\n average=total/No_of_input\n if(average >= 0):\n print(\"{:.2f}\".format(average))\n if(average < 0):\n print(\"Unknown\")\n```\n\n附一个C(http://blog.csdn.net/sinat_37765046/article/details/74787247)\n```\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n char a[100];\n int i,n,flag;\n double sum;//浮点数都设置为double\n while(gets(a))//注意输入有空格,scanf遇到空格就退出,用gets\n {\n flag=1;\n sum=n=0;//sum统计字符对应的和,n统计字符个数\n for(i=0;i<strlen(a);i+=2)//遇到空格跳过,故计数器为i+=2\n {\n if(a[i]=='A') sum+=4,n++;求平均数->求和+求个数\n else if(a[i]=='B') sum+=3,n++;\n else if(a[i]=='C') sum+=2,n++;\n else if(a[i]=='D') sum+=1,n++;\n else if(a[i]=='F') n++;\n else flag=0;//标志变量记录有无非法输入\n }\n if(flag)\n {\n printf(\"%.2f\\n\",sum/n);\n }\n else\n {\n printf(\"Unknown\\n\"); \n }\n n=0;\n sum=0;\n flag=1;//多次输入,所以计数器n,总和sum,标志变量flag都要复位\n }\n}\n```\n\n参考资料:\n1. https://www.pydanny.com/why-doesnt-python-have-switch-case.html\n2. http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://blog.csdn.net/sinat_37765046/article/details/74787247\",\"https://www.pydanny.com/why-doesnt-python-have-switch-case.html\",\"http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-10112018/01/17 01:14:21
spearouspublished a new post: python3-tk-1011
2018/01/17 01:14:21
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1011 |
| title | python3刷TK题库 1011: 软件版本 |
| body | 这又是多重判断选择问题,算是练一练条件判断的使用吧。python3有几种条件判断格式语句,并且可以嵌套: ``` if statement1: #outer if print("hello world") if nested_statement1: #first nested if print("yes") elif nested_statement2: #first nested elif print("maybe") else: #first nested else print("no") elif statement2: #outer elif print("hello galaxy") if nested_statement3: #second nested if print("yes") elif nested_statement4: #second nested elif print("maybe") else: #second nested else print("no") else: #outer else statement("hello universe") ``` 而逻辑关系运算符有: |Operator |What it means| |---------------|--------------------------------| |== |Equal to| |!= |Not equal to| |< |Less than| |> |Greater than| |<= |Less than or equal to| |>= |Greater than or equal to| |and | True only if both are true| |or |True if at least one is true| |not | True only if false| http://tk.hustoj.com/problem.php?id=1011 1011: 软件版本 时间限制: 1 Sec 内存限制: 32 MB 提交: 3321 解决: 1561 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 相信大家一定有过在网上下载软件而碰到多个不同版本的情况。一般来说,软件的版本号由三个部分组成,主版本号(Major Version Number),子版本号(Minor Version Number)和修订号(Revision_Number)。当软件进行了重大的修改时,主版本号加一;当软件在原有基础上增加部分功能时,主版本号不变,子版本号加一;当软件仅仅修正了部分bug时,主版本号和子版本号都不变,修正号加一。 在我们比较软件的两个版本的新旧时,都是先比较主版本号,当主版本号相同时再比较子版本号,前两者都相同的情况下再比较修正号。版本号越大的软件越新。 现在,小明在下载软件的时候碰到了两个版本,请你告诉他哪个版本更新一些。 输入 输入的第一行有一个整数T,代表有T组测试。接下来有T组测试。 每组测试分两行,第一行有三个整数代表第一个软件版本的主版本号,子版本号和修订号。第二行也有三个整数代表第二个软件版本的主版本号,子版本号和修订号。 数据中出现的整数都在[0,1000]范围之内。 输出 对于每组测试,如果第一个软件的版本新点,请输出First,如果第二个软件的版本新点,请输出Second,否则输出Same。 样例输入 3 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 样例输出 Second First Same 我的python3程序: ``` Number_of_test=int(input()) for i in range(0,Number_of_test): data_of_first=input() data_of_second=input() if data_of_first.split()[0] > data_of_second.split()[0]: print("First") elif data_of_first.split()[0] < data_of_second.split()[0]: print("Second") elif data_of_first.split()[0] == data_of_second.split()[0]: if data_of_first.split()[1] > data_of_second.split()[1]: print("First") elif data_of_first.split()[1] < data_of_second.split()[1]: print("Second") elif data_of_first.split()[1] == data_of_second.split()[1]: if data_of_first.split()[2] > data_of_second.split()[2]: print("First") elif data_of_first.split()[2] < data_of_second.split()[2]: print("Second") elif data_of_first.split()[2] == data_of_second.split()[2]: print("Same") ``` C ``` #include<stdio.h>//用数组做也行 main() { int t; int a[3],b[3]; int i; scanf("%d",&t); while(t--) { scanf("%d%d%d",&a[0],&a[1],&a[2]); scanf("%d%d%d",&b[0],&b[1],&b[2]); for(i=0;i<3;i++) { if(a[i]>b[i]) { printf("First\n"); break; } else { if(a[i]<b[i]) { printf("Second\n"); break; } } } if(i==3) printf("Same\n"); } } ``` C++ ``` #include <iostream> using namespace std; int main() { int n; cin>>n; while(n--) { int a[6]; for(int i=0;i<6;++i) { cin>>a[i]; } if(a[0]<a[3] || ((a[0]==a[3]) && (a[1]<a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]<a[5]))) cout<<"Second"<<endl; else if(a[0]>a[3] || ((a[0]==a[3]) && (a[1]>a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]>a[5]))) cout<<"First"<<endl; else cout<<"Same"<<endl; } return 0; } ``` 参考资料: 1. https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2 2. https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3 3. http://www.tk4479.net/u013041792/article/details/17123883 4. http://blog.csdn.net/AdamChinaren/article/details/18925505 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1011","https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2","https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3","http://www.tk4479.net/u013041792/article/details/17123883","http://blog.csdn.net/AdamChinaren/article/details/18925505"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19043312/Trx 51148567abed306b0364934d02ed0ae03eea158d |
View Raw JSON Data
{
"trx_id": "51148567abed306b0364934d02ed0ae03eea158d",
"block": 19043312,
"trx_in_block": 20,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-17T01:14:21",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1011",
"title": "python3刷TK题库 1011: 软件版本",
"body": "这又是多重判断选择问题,算是练一练条件判断的使用吧。python3有几种条件判断格式语句,并且可以嵌套:\n\n```\nif statement1: #outer if \n print(\"hello world\")\n\n if nested_statement1: #first nested if \n print(\"yes\")\n\n elif nested_statement2: #first nested elif\n print(\"maybe\")\n\n else: #first nested else\n print(\"no\")\n\nelif statement2: #outer elif\n print(\"hello galaxy\")\n\n if nested_statement3: #second nested if\n print(\"yes\")\n\n elif nested_statement4: #second nested elif\n print(\"maybe\")\n\n else: #second nested else\n print(\"no\")\n\nelse: #outer else\n statement(\"hello universe\")\n```\n\n而逻辑关系运算符有:\n\n\n|Operator\t|What it means|\n|---------------|--------------------------------|\n|==\t |Equal to|\n|!=\t |Not equal to|\n|<\t |Less than|\n|>\t |Greater than|\n|<=\t |Less than or equal to|\n|>=\t |Greater than or equal to|\n|and | True only if both are true|\n|or |True if at least one is true|\n|not | True only if false|\n\n\nhttp://tk.hustoj.com/problem.php?id=1011\n\n1011: 软件版本\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 3321 解决: 1561\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n相信大家一定有过在网上下载软件而碰到多个不同版本的情况。一般来说,软件的版本号由三个部分组成,主版本号(Major Version Number),子版本号(Minor Version Number)和修订号(Revision_Number)。当软件进行了重大的修改时,主版本号加一;当软件在原有基础上增加部分功能时,主版本号不变,子版本号加一;当软件仅仅修正了部分bug时,主版本号和子版本号都不变,修正号加一。\n在我们比较软件的两个版本的新旧时,都是先比较主版本号,当主版本号相同时再比较子版本号,前两者都相同的情况下再比较修正号。版本号越大的软件越新。\n现在,小明在下载软件的时候碰到了两个版本,请你告诉他哪个版本更新一些。\n输入\n输入的第一行有一个整数T,代表有T组测试。接下来有T组测试。\n每组测试分两行,第一行有三个整数代表第一个软件版本的主版本号,子版本号和修订号。第二行也有三个整数代表第二个软件版本的主版本号,子版本号和修订号。\n数据中出现的整数都在[0,1000]范围之内。\n输出\n对于每组测试,如果第一个软件的版本新点,请输出First,如果第二个软件的版本新点,请输出Second,否则输出Same。\n样例输入\n3\n1 1 0\n1 1 1\n1 1 1\n1 1 0\n1 1 1\n1 1 1\n样例输出\nSecond\nFirst\nSame\n\n\n我的python3程序:\n```\nNumber_of_test=int(input())\nfor i in range(0,Number_of_test):\n data_of_first=input()\n data_of_second=input()\n if data_of_first.split()[0] > data_of_second.split()[0]:\n print(\"First\")\n elif data_of_first.split()[0] < data_of_second.split()[0]:\n print(\"Second\")\n elif data_of_first.split()[0] == data_of_second.split()[0]:\n if data_of_first.split()[1] > data_of_second.split()[1]:\n print(\"First\")\n elif data_of_first.split()[1] < data_of_second.split()[1]:\n print(\"Second\")\n elif data_of_first.split()[1] == data_of_second.split()[1]:\n if data_of_first.split()[2] > data_of_second.split()[2]:\n print(\"First\")\n elif data_of_first.split()[2] < data_of_second.split()[2]:\n print(\"Second\")\n elif data_of_first.split()[2] == data_of_second.split()[2]:\n print(\"Same\")\n```\n\nC\n```\n#include<stdio.h>//用数组做也行\nmain()\n{\n int t;\n int a[3],b[3];\n int i;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d%d%d\",&a[0],&a[1],&a[2]);\n scanf(\"%d%d%d\",&b[0],&b[1],&b[2]);\n for(i=0;i<3;i++)\n {\n if(a[i]>b[i])\n {\n printf(\"First\\n\");\n break;\n }\n else\n {\n if(a[i]<b[i])\n {\n printf(\"Second\\n\");\n break;\n }\n }\n }\n if(i==3)\n printf(\"Same\\n\");\n }\n}\n```\n\nC++\n```\n#include <iostream> \n \nusing namespace std; \n \nint main() \n{ \n int n; \n cin>>n; \n while(n--) \n { \n int a[6]; \n for(int i=0;i<6;++i) \n { \n cin>>a[i]; \n } \n if(a[0]<a[3] || ((a[0]==a[3]) && (a[1]<a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]<a[5]))) \n cout<<\"Second\"<<endl; \n else if(a[0]>a[3] || ((a[0]==a[3]) && (a[1]>a[2])) || ((a[0]==a[3])&&(a[1]==a[4]) &&(a[2]>a[5]))) \n cout<<\"First\"<<endl; \n else \n cout<<\"Same\"<<endl; \n } \n return 0; \n} \n```\n\n\n参考资料:\n1. https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2\n2. https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3\n3. http://www.tk4479.net/u013041792/article/details/17123883\n4. http://blog.csdn.net/AdamChinaren/article/details/18925505",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1011\",\"https://www.digitalocean.com/community/tutorials/how-to-write-conditional-statements-in-python-3-2\",\"https://www.digitalocean.com/community/tutorials/understanding-boolean-logic-in-python-3\",\"http://www.tk4479.net/u013041792/article/details/17123883\",\"http://blog.csdn.net/AdamChinaren/article/details/18925505\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-10092018/01/16 18:56:39
spearouspublished a new post: python3-tk-1009
2018/01/16 18:56:39
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1009 |
| title | python3刷TK题库 1009: 财务管理 |
| body | 这道主要是输出的格式问题。在python3,有两种模式可选, print("¥%.2f" % average) print("¥{:.2f}".format(average)) 使用format来表达字符串是最新的方式,它有前一种无法实现的灵活性,如: 命令: print('{1} {0}'.format('one', 'two')) 相应输出: two one http://tk.hustoj.com/problem.php?id=1009 1009: 财务管理 时间限制: 1 Sec 内存限制: 32 MB 提交: 4479 解决: 2245 [提交][状态][讨论版][命题人:外部导入][下载1元][28kb] 题目描述 小明毕业一年了,并且找到了一份好工作。这一年里他赚了很多钱,现在他想知道他这一年里的平均月薪是多少,请你写一个程序帮他计算。 输入 输入包括12行。第i行为第i个月的实际月薪。(i=1,2,3...) 输出 输出小明的平均月薪,保留两位小数,并且最前面输出一个¥符号。 样例输入 100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75 样例输出 ¥1581.42 附一个CPP程序: ``` #include <iostream> #include <iomanip> #define MONTH 12 using namespace std; int main() { int i; float a,sum=0; for(i=1;i<=MONTH;++i) { cin>>a; sum+=a; } cout<<"¥"<<setiosflags(ios::fixed)<<setprecision(2)<<sum/12<<endl; return 0; } ``` 我的python3程序: ``` month_salary=0 total=0 for i in range(0,12): month_salary=float(input()) total=total+month_salary i=i+1 average=total/12 print("¥{:.2f}".format(average)) ``` 参考资料 1. https://pyformat.info/ 2. https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/ 3. https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1009","https://pyformat.info/","https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/","https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19035759/Trx 0101a118cdd9e25f55f0270bdd5465ce11ef8a42 |
View Raw JSON Data
{
"trx_id": "0101a118cdd9e25f55f0270bdd5465ce11ef8a42",
"block": 19035759,
"trx_in_block": 6,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T18:56:39",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1009",
"title": "python3刷TK题库 1009: 财务管理",
"body": "这道主要是输出的格式问题。在python3,有两种模式可选,\nprint(\"¥%.2f\" % average)\nprint(\"¥{:.2f}\".format(average))\n\n使用format来表达字符串是最新的方式,它有前一种无法实现的灵活性,如:\n命令: print('{1} {0}'.format('one', 'two'))\n相应输出: two one\n\n\nhttp://tk.hustoj.com/problem.php?id=1009 \n\n1009: 财务管理\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 4479 解决: 2245\n[提交][状态][讨论版][命题人:外部导入][下载1元][28kb]\n题目描述\n小明毕业一年了,并且找到了一份好工作。这一年里他赚了很多钱,现在他想知道他这一年里的平均月薪是多少,请你写一个程序帮他计算。\n输入\n输入包括12行。第i行为第i个月的实际月薪。(i=1,2,3...)\n输出\n输出小明的平均月薪,保留两位小数,并且最前面输出一个¥符号。\n样例输入\n100.00 \n489.12 \n12454.12 \n1234.10 \n823.05 \n109.20 \n5.27 \n1542.25 \n839.18 \n83.99 \n1295.01 \n1.75\n样例输出\n¥1581.42\n\n\n附一个CPP程序:\n```\n#include <iostream> \n#include <iomanip> \n#define MONTH 12 \nusing namespace std; \n \nint main() \n{ \n int i; \n float a,sum=0; \n for(i=1;i<=MONTH;++i) \n { \n cin>>a; \n sum+=a; \n } \n \n cout<<\"¥\"<<setiosflags(ios::fixed)<<setprecision(2)<<sum/12<<endl; \n return 0; \n} \n```\n\n我的python3程序:\n```\nmonth_salary=0\ntotal=0\nfor i in range(0,12):\n month_salary=float(input())\n total=total+month_salary\n i=i+1\naverage=total/12\nprint(\"¥{:.2f}\".format(average))\n```\n\n参考资料\n1. https://pyformat.info/\n2. https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/\n3. https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1009\",\"https://pyformat.info/\",\"https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/\",\"https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-10102018/01/16 14:15:45
spearouspublished a new post: python3-tk-1010
2018/01/16 14:15:45
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1010 |
| title | python3刷TK题库 1010: 平均绩点 |
| body | @@ -2173,8 +2173,77 @@ .html%0A2. + http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://blog.csdn.net/sinat_37765046/article/details/74787247","https://www.pydanny.com/why-doesnt-python-have-switch-case.html","http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19030142/Trx 0fe847124d23ec6159772da5680868399ee90e75 |
View Raw JSON Data
{
"trx_id": "0fe847124d23ec6159772da5680868399ee90e75",
"block": 19030142,
"trx_in_block": 51,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T14:15:45",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1010",
"title": "python3刷TK题库 1010: 平均绩点",
"body": "@@ -2173,8 +2173,77 @@\n .html%0A2.\n+ http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://blog.csdn.net/sinat_37765046/article/details/74787247\",\"https://www.pydanny.com/why-doesnt-python-have-switch-case.html\",\"http://www.wellho.net/resources/ex.php4?item=y103/python_switch_case\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}cn-naughty.boyreplied to @spearous / 20180116t141518389z-post2018/01/16 14:15:30
cn-naughty.boyreplied to @spearous / 20180116t141518389z-post
2018/01/16 14:15:30
| parent author | spearous |
| parent permlink | python3-tk-1010 |
| author | cn-naughty.boy |
| permlink | 20180116t141518389z-post |
| title | |
| body | 这就是文章该有的气质! |
| json metadata | {"tags":["cn"]} |
| Transaction Info | Block #19030137/Trx 68642b82762be55978145e84a9de2c77a5472b50 |
View Raw JSON Data
{
"trx_id": "68642b82762be55978145e84a9de2c77a5472b50",
"block": 19030137,
"trx_in_block": 36,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T14:15:30",
"op": [
"comment",
{
"parent_author": "spearous",
"parent_permlink": "python3-tk-1010",
"author": "cn-naughty.boy",
"permlink": "20180116t141518389z-post",
"title": "",
"body": "这就是文章该有的气质!",
"json_metadata": "{\"tags\":[\"cn\"]}"
}
]
}cn-naughty.boyupvoted (3.97%) @spearous / python3-tk-10102018/01/16 14:15:27
cn-naughty.boyupvoted (3.97%) @spearous / python3-tk-1010
2018/01/16 14:15:27
| voter | cn-naughty.boy |
| author | spearous |
| permlink | python3-tk-1010 |
| weight | 397 (3.97%) |
| Transaction Info | Block #19030136/Trx a71d5163abb4118998baa77db7b420b65d04a3de |
View Raw JSON Data
{
"trx_id": "a71d5163abb4118998baa77db7b420b65d04a3de",
"block": 19030136,
"trx_in_block": 6,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T14:15:27",
"op": [
"vote",
{
"voter": "cn-naughty.boy",
"author": "spearous",
"permlink": "python3-tk-1010",
"weight": 397
}
]
}spearouspublished a new post: python3-tk-10102018/01/16 14:15:12
spearouspublished a new post: python3-tk-1010
2018/01/16 14:15:12
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1010 |
| title | python3刷TK题库 1010: 平均绩点 |
| body | 仍然是语言基础问题,这次主要是选择结构的使用。和C/C++不一样的是,python没有switch...case结构,所以遇到多种情况的选择,一般要么用很多if,要么用python特有的数据结构--字典。我的实现使用很多if。如果想要pythonic一点,那肯定是用字典了。当然,也有用python的函数自己实现一个switch...case结构的。 1010: 平均绩点 时间限制: 1 Sec 内存限制: 32 MB 提交: 5803 解决: 1850 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 每门课的成绩分为A、B、C、D、F五个等级,为了计算平均绩点,规定A、B、C、D、F分别代表4分、3分、2分、1分、0分。 输入 有多组测试样例。每组输入数据占一行,由一个或多个大写字母组成,字母之间由空格分隔。 输出 每组输出结果占一行。如果输入的大写字母都在集合{A,B,C,D,F}中,则输出对应的平均绩点,结果保留两位小数。否则,输出“Unknown”。 样例输入 A B C D F B F F C C A D C E F 样例输出 2.00 1.83 Unknown 我的python3程序: ``` while True: total=0 Grade_in_letter=input() No_of_input=len(Grade_in_letter.split(' ')) for i in range(0, No_of_input): if (Grade_in_letter.split(' ')[i]=='A'): total=total+4 elif (Grade_in_letter.split(' ')[i]=='B'): total=total+3 elif (Grade_in_letter.split(' ')[i]=='C'): total=total+2 elif (Grade_in_letter.split(' ')[i]=='D'): total=total+1 elif (Grade_in_letter.split(' ')[i]=='F'): total=total+0 else: total=-1 break average=total/No_of_input if(average >= 0): print("{:.2f}".format(average)) if(average < 0): print("Unknown") ``` 附一个C(http://blog.csdn.net/sinat_37765046/article/details/74787247) ``` #include <stdio.h> #include <string.h> int main() { char a[100]; int i,n,flag; double sum;//浮点数都设置为double while(gets(a))//注意输入有空格,scanf遇到空格就退出,用gets { flag=1; sum=n=0;//sum统计字符对应的和,n统计字符个数 for(i=0;i<strlen(a);i+=2)//遇到空格跳过,故计数器为i+=2 { if(a[i]=='A') sum+=4,n++;求平均数->求和+求个数 else if(a[i]=='B') sum+=3,n++; else if(a[i]=='C') sum+=2,n++; else if(a[i]=='D') sum+=1,n++; else if(a[i]=='F') n++; else flag=0;//标志变量记录有无非法输入 } if(flag) { printf("%.2f\n",sum/n); } else { printf("Unknown\n"); } n=0; sum=0; flag=1;//多次输入,所以计数器n,总和sum,标志变量flag都要复位 } } ``` 参考资料: 1. https://www.pydanny.com/why-doesnt-python-have-switch-case.html 2. |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://blog.csdn.net/sinat_37765046/article/details/74787247","https://www.pydanny.com/why-doesnt-python-have-switch-case.html"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19030131/Trx e04370b8c5a058765396d40358f490554db46899 |
View Raw JSON Data
{
"trx_id": "e04370b8c5a058765396d40358f490554db46899",
"block": 19030131,
"trx_in_block": 46,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T14:15:12",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1010",
"title": "python3刷TK题库 1010: 平均绩点",
"body": "仍然是语言基础问题,这次主要是选择结构的使用。和C/C++不一样的是,python没有switch...case结构,所以遇到多种情况的选择,一般要么用很多if,要么用python特有的数据结构--字典。我的实现使用很多if。如果想要pythonic一点,那肯定是用字典了。当然,也有用python的函数自己实现一个switch...case结构的。\n\n1010: 平均绩点\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 5803 解决: 1850\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n每门课的成绩分为A、B、C、D、F五个等级,为了计算平均绩点,规定A、B、C、D、F分别代表4分、3分、2分、1分、0分。\n输入\n有多组测试样例。每组输入数据占一行,由一个或多个大写字母组成,字母之间由空格分隔。\n输出\n每组输出结果占一行。如果输入的大写字母都在集合{A,B,C,D,F}中,则输出对应的平均绩点,结果保留两位小数。否则,输出“Unknown”。\n样例输入\nA B C D F\nB F F C C A\nD C E F\n样例输出\n2.00\n1.83\nUnknown\n\n我的python3程序:\n```\nwhile True:\n total=0\n Grade_in_letter=input()\n No_of_input=len(Grade_in_letter.split(' '))\n for i in range(0, No_of_input):\n if (Grade_in_letter.split(' ')[i]=='A'):\n total=total+4\n elif (Grade_in_letter.split(' ')[i]=='B'):\n total=total+3\n elif (Grade_in_letter.split(' ')[i]=='C'):\n total=total+2\n elif (Grade_in_letter.split(' ')[i]=='D'):\n total=total+1\n elif (Grade_in_letter.split(' ')[i]=='F'):\n total=total+0 \n else:\n total=-1\n break\n average=total/No_of_input\n if(average >= 0):\n print(\"{:.2f}\".format(average))\n if(average < 0):\n print(\"Unknown\")\n```\n\n附一个C(http://blog.csdn.net/sinat_37765046/article/details/74787247)\n```\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n char a[100];\n int i,n,flag;\n double sum;//浮点数都设置为double\n while(gets(a))//注意输入有空格,scanf遇到空格就退出,用gets\n {\n flag=1;\n sum=n=0;//sum统计字符对应的和,n统计字符个数\n for(i=0;i<strlen(a);i+=2)//遇到空格跳过,故计数器为i+=2\n {\n if(a[i]=='A') sum+=4,n++;求平均数->求和+求个数\n else if(a[i]=='B') sum+=3,n++;\n else if(a[i]=='C') sum+=2,n++;\n else if(a[i]=='D') sum+=1,n++;\n else if(a[i]=='F') n++;\n else flag=0;//标志变量记录有无非法输入\n }\n if(flag)\n {\n printf(\"%.2f\\n\",sum/n);\n }\n else\n {\n printf(\"Unknown\\n\"); \n }\n n=0;\n sum=0;\n flag=1;//多次输入,所以计数器n,总和sum,标志变量flag都要复位\n }\n}\n```\n\n参考资料:\n1. https://www.pydanny.com/why-doesnt-python-have-switch-case.html\n2.",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://blog.csdn.net/sinat_37765046/article/details/74787247\",\"https://www.pydanny.com/why-doesnt-python-have-switch-case.html\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: python3-tk-10092018/01/16 04:11:18
spearouspublished a new post: python3-tk-1009
2018/01/16 04:11:18
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | python3-tk-1009 |
| title | python3刷TK题库 1009: 财务管理 |
| body | 这道主要是输出的格式问题。在python3,有两种模式可选, print("¥%.2f" % average) print("¥{:.2f}".format(average)) 使用format来表达字符串是最新的方式,它有前一种无法实现的灵活性,如: 命令: print('{1} {0}'.format('one', 'two')) 相应输出: two one http://tk.hustoj.com/problem.php?id=1009 1009: 财务管理 时间限制: 1 Sec 内存限制: 32 MB 提交: 4479 解决: 2245 [提交][状态][讨论版][命题人:外部导入][下载1元][28kb] 题目描述 小明毕业一年了,并且找到了一份好工作。这一年里他赚了很多钱,现在他想知道他这一年里的平均月薪是多少,请你写一个程序帮他计算。 输入 输入包括12行。第i行为第i个月的实际月薪。(i=1,2,3...) 输出 输出小明的平均月薪,保留两位小数,并且最前面输出一个¥符号。 样例输入 100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75 样例输出 ¥1581.42 附一个CPP程序: ``` #include <iostream> #include <iomanip> #define MONTH 12 using namespace std; int main() { int i; float a,sum=0; for(i=1;i<=MONTH;++i) { cin>>a; sum+=a; } cout<<"¥"<<setiosflags(ios::fixed)<<setprecision(2)<<sum/12<<endl; return 0; } ``` 我的python3程序: ``` month_salary=0 total=0 for i in range(0,12): month_salary=float(input()) total=total+month_salary i=i+1 average=total/12 print("¥{:.2f}".format(average)) ``` 参考资料 1. https://pyformat.info/ 2. https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/ 3. https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1009","https://pyformat.info/","https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/","https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19018054/Trx f019656ffeaa2f1635ae0d6855c6e27fddcfc9cc |
View Raw JSON Data
{
"trx_id": "f019656ffeaa2f1635ae0d6855c6e27fddcfc9cc",
"block": 19018054,
"trx_in_block": 5,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-16T04:11:18",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "python3-tk-1009",
"title": "python3刷TK题库 1009: 财务管理",
"body": "这道主要是输出的格式问题。在python3,有两种模式可选,\nprint(\"¥%.2f\" % average)\nprint(\"¥{:.2f}\".format(average))\n\n使用format来表达字符串是最新的方式,它有前一种无法实现的灵活性,如:\n命令: print('{1} {0}'.format('one', 'two'))\n相应输出: two one\n\n\nhttp://tk.hustoj.com/problem.php?id=1009 \n\n1009: 财务管理\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 4479 解决: 2245\n[提交][状态][讨论版][命题人:外部导入][下载1元][28kb]\n题目描述\n小明毕业一年了,并且找到了一份好工作。这一年里他赚了很多钱,现在他想知道他这一年里的平均月薪是多少,请你写一个程序帮他计算。\n输入\n输入包括12行。第i行为第i个月的实际月薪。(i=1,2,3...)\n输出\n输出小明的平均月薪,保留两位小数,并且最前面输出一个¥符号。\n样例输入\n100.00 \n489.12 \n12454.12 \n1234.10 \n823.05 \n109.20 \n5.27 \n1542.25 \n839.18 \n83.99 \n1295.01 \n1.75\n样例输出\n¥1581.42\n\n\n附一个CPP程序:\n```\n#include <iostream> \n#include <iomanip> \n#define MONTH 12 \nusing namespace std; \n \nint main() \n{ \n int i; \n float a,sum=0; \n for(i=1;i<=MONTH;++i) \n { \n cin>>a; \n sum+=a; \n } \n \n cout<<\"¥\"<<setiosflags(ios::fixed)<<setprecision(2)<<sum/12<<endl; \n return 0; \n} \n```\n\n我的python3程序:\n```\nmonth_salary=0\ntotal=0\nfor i in range(0,12):\n month_salary=float(input())\n total=total+month_salary\n i=i+1\naverage=total/12\nprint(\"¥{:.2f}\".format(average))\n```\n\n参考资料\n1. https://pyformat.info/\n2. https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/\n3. https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1009\",\"https://pyformat.info/\",\"https://www.ploggingdev.com/2016/11/floating-point-arithmetic-issues-in-python-3/\",\"https://stackoverflow.com/questions/8885663/how-to-format-a-floating-number-to-fixed-width-in-python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1008-ascii-python3-python32018/01/15 23:31:48
spearouspublished a new post: tk-1008-ascii-python3-python3
2018/01/15 23:31:48
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1008-ascii-python3-python3 |
| title | python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出) |
| body | 这个题目本身好像是有问题的。我按照它的描述编程,结果一直不过。后来在网上找了别人通过的C和C++代码,发现能通过的输出其实是另一种不同的格式。于是,我又把我的python3程序按照这个新的输出格式写,结果就通过了。这说明题目自己的描述是有问题的! 不过,为了通过这个题目,我学了不少python3的输入和输出控制,也算是有不小的收获。 ### python3 如何读取多行输入? 如前面所述,python3只有input()一种读取输入的函数,远不如C/C++灵活。inpupt()读取输入的限制在于,它只能读取一行,并且是一下子读一行。不能像C/C++一样,读取单个输入。这就给,多行输入和需要控制输入的数量的场合带来麻烦。网上有一些解决办法,我采用的是: 遇到多行输入,先用input读取每行的输入,存入数组,然后使用join方法,把他们连成一个大的字符串。 ``` lines = [] while True: line = input() if line: lines.append(line) else: break text = ' '.join(lines) ``` 其中,text=' '.join(lines)表示连接数组元素的时候,每个元素间隔为一个空格。这个也可以改为其他字符,如 text='-'.join(lines)表示用"-"连接。 另外对输入的数量可用: current_number_of_input=len(line.split) 来算出,当前line可以被分割成多少个输入。 ### 把输出控制在同一行: python3的print函数的原型为: ``` print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) ``` 这里面可以看出,因为默认end='\n'所以print()的输出一般来说都要自动换行。而有的场合不适合输出自动换行,因此只要改变end的默认值就行了:你写清end=''就可以了。 ``` print('%c' % chr(int(char[i])),end='') ``` ### python3 支持的转义字符 (原表见官方文档:https://docs.python.org/3.6/reference/lexical_analysis.html ) | Escape Sequence | Meaning | |---------------|-----------------------------------------| |\newline |Backslash and newline ignored| |\\ |Backslash (\) | |\' |Single quote (') | |\" |Double quote (") | |\a |ASCII Bell (BEL) | |\b |ASCII Backspace (BS) | |\f |ASCII Formfeed (FF) | |\n |ASCII Linefeed (LF) | |\r |ASCII Carriage Return (CR) | |\t |ASCII Horizontal Tab (TAB) | |\v |ASCII Vertical Tab (VT) | |\ooo |Character with octal value | |\xhh |Character with hex value | 这次的题目是: http://tk.hustoj.com/problem.php?id=1008 1008: ASCII码 时间限制: 1 Sec 内存限制: 32 MB 提交: 5669 解决: 3304 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 相信大家一定都知道大名鼎鼎的ASCII码,这次给你的任务是输入数字(表示ASCII码),输出相对应的字符信息。 输入 第一行为一个整数T(1<=T<=1000)。 接下来包括T个正整数,由空白符分割。(空白符包括空格、换行、制表符) 这些整数不会小于32。 输出 在一行内输出相应的字符信息。(注意不要输出任何多余的字符) 样例输入 13 72 101 108 108 111 44 32 119 111 114 108 100 33 样例输出 Hello, world! 原本看题目,以为是所有的13个数字都输入之后,处理完制表符,空格,换行之后,再显示对应的字符串。所以,就需要python读取可能的多行输入,再输出到同一行。 然后一直不通过,所以看了一下别人通过的C和C++程序,才发现,原来是一次换行,就显示一下已有的输入对应的ASCII码,比如: http://www.voidcn.com/article/p-rxdyqkuo-yq.html ``` #include <iostream> using namespace std; int main() { int n,a; cin>>n; while(n--) { cin>>a; cout<<char(a); if(!n) cout<<endl; } return 0; } ``` http://blog.csdn.net/sinat_37765046/article/details/72827961 ``` #include<stdio.h> main() { int t; int i; int a[10000]; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d",&a[i]); } for(i=0;i<t;i++) { printf("%c",a[i]); } printf("\n"); } ``` 所以,我也修改成这样的输出方式,我的python3程序: ``` i=0 counter=0 std_in=[] number_of_input_char=int(input()) while (number_of_input_char-counter): line = input() char=line.split() i=len(char) counter=counter+i a=0 while (a-i<0): print('%c' % chr(int(char[a])),end='') a=a+1 ``` 再附一个按照它题目叙述的输出方式写的python3,这个是不能AC的,但是是忠于题目原意的: ``` number_of_input_char=int(input()) lines = [] while True: line = input() if line: lines.append(line) else: break text = ' '.join(lines) char=text.split() for i in range(0, number_of_input_char): if (int(char[i]) >= 32): print('%c' % chr(int(char[i])),end='') else: break ``` 参考资料: 1. https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user 2. https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically 3. https://docs.python.org/3.6/reference/lexical_analysis.html |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://docs.python.org/3.6/reference/lexical_analysis.html","http://tk.hustoj.com/problem.php?id=1008","http://www.voidcn.com/article/p-rxdyqkuo-yq.html","http://blog.csdn.net/sinat_37765046/article/details/72827961","https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user","https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012466/Trx b98abbb2021957775fddaab57ed68ae4c60ccddc |
View Raw JSON Data
{
"trx_id": "b98abbb2021957775fddaab57ed68ae4c60ccddc",
"block": 19012466,
"trx_in_block": 25,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:31:48",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1008-ascii-python3-python3",
"title": "python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出)",
"body": "这个题目本身好像是有问题的。我按照它的描述编程,结果一直不过。后来在网上找了别人通过的C和C++代码,发现能通过的输出其实是另一种不同的格式。于是,我又把我的python3程序按照这个新的输出格式写,结果就通过了。这说明题目自己的描述是有问题的!\n\n不过,为了通过这个题目,我学了不少python3的输入和输出控制,也算是有不小的收获。\n\n\n### python3 如何读取多行输入?\n\n如前面所述,python3只有input()一种读取输入的函数,远不如C/C++灵活。inpupt()读取输入的限制在于,它只能读取一行,并且是一下子读一行。不能像C/C++一样,读取单个输入。这就给,多行输入和需要控制输入的数量的场合带来麻烦。网上有一些解决办法,我采用的是:\n\n遇到多行输入,先用input读取每行的输入,存入数组,然后使用join方法,把他们连成一个大的字符串。\n\n```\nlines = []\nwhile True:\n line = input()\n if line:\n lines.append(line)\n else:\n break\ntext = ' '.join(lines)\n```\n\n其中,text=' '.join(lines)表示连接数组元素的时候,每个元素间隔为一个空格。这个也可以改为其他字符,如 text='-'.join(lines)表示用\"-\"连接。\n\n另外对输入的数量可用:\ncurrent_number_of_input=len(line.split)\n来算出,当前line可以被分割成多少个输入。\n\n\n### 把输出控制在同一行:\n\npython3的print函数的原型为:\n```\nprint(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)\n```\n这里面可以看出,因为默认end='\\n'所以print()的输出一般来说都要自动换行。而有的场合不适合输出自动换行,因此只要改变end的默认值就行了:你写清end=''就可以了。\n\n```\n print('%c' % chr(int(char[i])),end='')\n```\n\n\n### python3 支持的转义字符\n(原表见官方文档:https://docs.python.org/3.6/reference/lexical_analysis.html )\n\n| Escape Sequence | Meaning |\n|---------------|-----------------------------------------|\n|\\newline\t|Backslash and newline ignored|\t \n|\\\\\t |Backslash (\\)\t |\n|\\'\t |Single quote (')\t |\n|\\\"\t |Double quote (\")\t |\n|\\a\t |ASCII Bell (BEL)\t |\n|\\b\t |ASCII Backspace (BS)\t |\n|\\f\t |ASCII Formfeed (FF)\t |\n|\\n\t |ASCII Linefeed (LF)\t |\n|\\r\t |ASCII Carriage Return (CR)\t |\n|\\t\t |ASCII Horizontal Tab (TAB)\t |\n|\\v\t |ASCII Vertical Tab (VT)\t |\n|\\ooo\t |Character with octal value |\n|\\xhh\t |Character with hex value |\n\n\n\n这次的题目是:\n\nhttp://tk.hustoj.com/problem.php?id=1008 \n\n1008: ASCII码\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 5669 解决: 3304\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n相信大家一定都知道大名鼎鼎的ASCII码,这次给你的任务是输入数字(表示ASCII码),输出相对应的字符信息。\n输入\n第一行为一个整数T(1<=T<=1000)。\n接下来包括T个正整数,由空白符分割。(空白符包括空格、换行、制表符)\n这些整数不会小于32。\n输出\n在一行内输出相应的字符信息。(注意不要输出任何多余的字符)\n样例输入\n13\n72 101 108 108 111 44\n32 119 111 114 108 100 33\n样例输出\nHello, world!\n\n\n原本看题目,以为是所有的13个数字都输入之后,处理完制表符,空格,换行之后,再显示对应的字符串。所以,就需要python读取可能的多行输入,再输出到同一行。\n\n然后一直不通过,所以看了一下别人通过的C和C++程序,才发现,原来是一次换行,就显示一下已有的输入对应的ASCII码,比如:\n\nhttp://www.voidcn.com/article/p-rxdyqkuo-yq.html\n```\n#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n int n,a;\n cin>>n;\n while(n--)\n {\n cin>>a;\n cout<<char(a);\n if(!n)\n cout<<endl;\n }\n return 0;\n}\n```\n\nhttp://blog.csdn.net/sinat_37765046/article/details/72827961\n```\n#include<stdio.h> \nmain() \n{ \n int t; \n int i; \n int a[10000]; \n scanf(\"%d\",&t); \n for(i=0;i<t;i++) \n { \n scanf(\"%d\",&a[i]); \n } \n for(i=0;i<t;i++) \n { \n printf(\"%c\",a[i]); \n } \n printf(\"\\n\"); \n} \n```\n\n所以,我也修改成这样的输出方式,我的python3程序:\n\n```\ni=0\ncounter=0\nstd_in=[]\nnumber_of_input_char=int(input())\n\nwhile (number_of_input_char-counter):\n line = input()\n char=line.split()\n i=len(char)\n counter=counter+i\n a=0\n while (a-i<0):\n print('%c' % chr(int(char[a])),end='')\n a=a+1\n```\n\n\n再附一个按照它题目叙述的输出方式写的python3,这个是不能AC的,但是是忠于题目原意的:\n```\nnumber_of_input_char=int(input())\n \nlines = []\nwhile True:\n line = input()\n if line:\n lines.append(line)\n else:\n break\ntext = ' '.join(lines)\n\nchar=text.split()\n\nfor i in range(0, number_of_input_char):\n if (int(char[i]) >= 32):\n print('%c' % chr(int(char[i])),end='')\n else:\n break\n```\n\n参考资料:\n1. https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\n2. https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\n3. https://docs.python.org/3.6/reference/lexical_analysis.html",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://docs.python.org/3.6/reference/lexical_analysis.html\",\"http://tk.hustoj.com/problem.php?id=1008\",\"http://www.voidcn.com/article/p-rxdyqkuo-yq.html\",\"http://blog.csdn.net/sinat_37765046/article/details/72827961\",\"https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\",\"https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1008-ascii-python3-python32018/01/15 23:30:45
spearouspublished a new post: tk-1008-ascii-python3-python3
2018/01/15 23:30:45
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1008-ascii-python3-python3 |
| title | python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出) |
| body | @@ -968,16 +968,25 @@ %E6%94%AF%E6%8C%81%E7%9A%84%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6%0A +(%E5%8E%9F%E8%A1%A8%E8%A7%81%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3%EF%BC%9A https:// @@ -1037,16 +1037,17 @@ is.html +) %0A%0A%7C Esca @@ -3912,8 +3912,71 @@ amically +%0A3. https://docs.python.org/3.6/reference/lexical_analysis.html |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://docs.python.org/3.6/reference/lexical_analysis.html","http://tk.hustoj.com/problem.php?id=1008","http://www.voidcn.com/article/p-rxdyqkuo-yq.html","http://blog.csdn.net/sinat_37765046/article/details/72827961","https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user","https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012445/Trx 3c02957c100262b1a753712ae33f62b5569436ba |
View Raw JSON Data
{
"trx_id": "3c02957c100262b1a753712ae33f62b5569436ba",
"block": 19012445,
"trx_in_block": 17,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:30:45",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1008-ascii-python3-python3",
"title": "python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出)",
"body": "@@ -968,16 +968,25 @@\n %E6%94%AF%E6%8C%81%E7%9A%84%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6%0A\n+(%E5%8E%9F%E8%A1%A8%E8%A7%81%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3%EF%BC%9A\n https://\n@@ -1037,16 +1037,17 @@\n is.html \n+)\n %0A%0A%7C Esca\n@@ -3912,8 +3912,71 @@\n amically\n+%0A3. https://docs.python.org/3.6/reference/lexical_analysis.html\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://docs.python.org/3.6/reference/lexical_analysis.html\",\"http://tk.hustoj.com/problem.php?id=1008\",\"http://www.voidcn.com/article/p-rxdyqkuo-yq.html\",\"http://blog.csdn.net/sinat_37765046/article/details/72827961\",\"https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\",\"https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1008-ascii-python3-python32018/01/15 23:28:54
spearouspublished a new post: tk-1008-ascii-python3-python3
2018/01/15 23:28:54
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1008-ascii-python3-python3 |
| title | python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出) |
| body | @@ -588,17 +588,17 @@ text=' -* +- '.join(l @@ -609,11 +609,11 @@ )%E8%A1%A8%E7%A4%BA%E7%94%A8 -%E2%80%9C*%E2%80%9D +%22-%22 %E8%BF%9E%E6%8E%A5%E3%80%82%0A |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://docs.python.org/3.6/reference/lexical_analysis.html","http://tk.hustoj.com/problem.php?id=1008","http://www.voidcn.com/article/p-rxdyqkuo-yq.html","http://blog.csdn.net/sinat_37765046/article/details/72827961","https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user","https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012408/Trx ab3127dc2c9255fa4df0a730d6e45faab2d44080 |
View Raw JSON Data
{
"trx_id": "ab3127dc2c9255fa4df0a730d6e45faab2d44080",
"block": 19012408,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:28:54",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1008-ascii-python3-python3",
"title": "python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出)",
"body": "@@ -588,17 +588,17 @@\n text='\n-*\n+-\n '.join(l\n@@ -609,11 +609,11 @@\n )%E8%A1%A8%E7%A4%BA%E7%94%A8\n-%E2%80%9C*%E2%80%9D\n+%22-%22\n %E8%BF%9E%E6%8E%A5%E3%80%82%0A\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://docs.python.org/3.6/reference/lexical_analysis.html\",\"http://tk.hustoj.com/problem.php?id=1008\",\"http://www.voidcn.com/article/p-rxdyqkuo-yq.html\",\"http://blog.csdn.net/sinat_37765046/article/details/72827961\",\"https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\",\"https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1008-ascii-python3-python32018/01/15 23:28:12
spearouspublished a new post: tk-1008-ascii-python3-python3
2018/01/15 23:28:12
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1008-ascii-python3-python3 |
| title | python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出) |
| body | @@ -1030,16 +1030,136 @@ .html %0A%0A +%7C Escape Sequence %7C Meaning %7C%0A%7C---------------%7C-----------------------------------------%7C%0A%7C %5Cnewline @@ -1159,16 +1159,17 @@ newline%09 +%7C Backslas @@ -1189,19 +1189,21 @@ ignored +%7C %09 %0A +%7C %5C%5C%09 @@ -1213,16 +1213,17 @@ +%7C Backslas @@ -1229,17 +1229,52 @@ sh (%5C)%09 -%0A + %7C%0A%7C %5C'%09 @@ -1284,16 +1284,17 @@ +%7C Single q @@ -1303,17 +1303,44 @@ te (')%09 -%0A + %7C%0A%7C %5C%22%09 @@ -1350,16 +1350,17 @@ +%7C Double q @@ -1369,17 +1369,44 @@ te (%22)%09 -%0A + %7C%0A%7C %5Ca%09 @@ -1412,24 +1412,25 @@ +%7C ASCII Bell ( @@ -1435,17 +1435,44 @@ (BEL)%09 -%0A + %7C%0A%7C %5Cb%09 @@ -1478,24 +1478,25 @@ +%7C ASCII Backsp @@ -1505,17 +1505,36 @@ e (BS)%09 -%0A + %7C%0A%7C %5Cf%09 @@ -1540,24 +1540,25 @@ +%7C ASCII Formfe @@ -1566,17 +1566,36 @@ d (FF)%09 -%0A + %7C%0A%7C %5Cn%09 @@ -1601,24 +1601,25 @@ +%7C ASCII Linefe @@ -1627,17 +1627,36 @@ d (LF)%09 -%0A + %7C%0A%7C %5Cr%09 @@ -1662,24 +1662,25 @@ +%7C ASCII Carria @@ -1695,17 +1695,28 @@ n (CR)%09 -%0A + %7C%0A%7C %5Ct%09 @@ -1722,24 +1722,25 @@ +%7C ASCII Horizo @@ -1755,17 +1755,20 @@ (TAB)%09 -%0A + %7C%0A%7C %5Cv%09 @@ -1778,16 +1778,17 @@ +%7C ASCII Ve @@ -1804,17 +1804,36 @@ b (VT)%09 -%0A + %7C%0A%7C %5Cooo%09 @@ -1829,32 +1829,33 @@ %7C%0A%7C%5Cooo%09 +%7C Character with o @@ -1865,17 +1865,29 @@ l value -%0A + %7C%0A%7C %5Cxhh%09 @@ -1891,16 +1891,17 @@ +%7C Characte @@ -1916,16 +1916,31 @@ ex value + %7C %0A%0A%0A%0A%E8%BF%99%E6%AC%A1%E7%9A%84%E9%A2%98 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://docs.python.org/3.6/reference/lexical_analysis.html","http://tk.hustoj.com/problem.php?id=1008","http://www.voidcn.com/article/p-rxdyqkuo-yq.html","http://blog.csdn.net/sinat_37765046/article/details/72827961","https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user","https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012394/Trx 640379bcb1e2eb028f3c6bb588085179a20f0520 |
View Raw JSON Data
{
"trx_id": "640379bcb1e2eb028f3c6bb588085179a20f0520",
"block": 19012394,
"trx_in_block": 22,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:28:12",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1008-ascii-python3-python3",
"title": "python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出)",
"body": "@@ -1030,16 +1030,136 @@\n .html %0A%0A\n+%7C Escape Sequence %7C Meaning %7C%0A%7C---------------%7C-----------------------------------------%7C%0A%7C\n %5Cnewline\n@@ -1159,16 +1159,17 @@\n newline%09\n+%7C\n Backslas\n@@ -1189,19 +1189,21 @@\n ignored\n+%7C\n %09 %0A\n+%7C\n %5C%5C%09 \n@@ -1213,16 +1213,17 @@\n \n+%7C\n Backslas\n@@ -1229,17 +1229,52 @@\n sh (%5C)%09 \n-%0A\n+ %7C%0A%7C\n %5C'%09 \n@@ -1284,16 +1284,17 @@\n \n+%7C\n Single q\n@@ -1303,17 +1303,44 @@\n te (')%09 \n-%0A\n+ %7C%0A%7C\n %5C%22%09 \n@@ -1350,16 +1350,17 @@\n \n+%7C\n Double q\n@@ -1369,17 +1369,44 @@\n te (%22)%09 \n-%0A\n+ %7C%0A%7C\n %5Ca%09 \n@@ -1412,24 +1412,25 @@\n \n+%7C\n ASCII Bell (\n@@ -1435,17 +1435,44 @@\n (BEL)%09 \n-%0A\n+ %7C%0A%7C\n %5Cb%09 \n@@ -1478,24 +1478,25 @@\n \n+%7C\n ASCII Backsp\n@@ -1505,17 +1505,36 @@\n e (BS)%09 \n-%0A\n+ %7C%0A%7C\n %5Cf%09 \n@@ -1540,24 +1540,25 @@\n \n+%7C\n ASCII Formfe\n@@ -1566,17 +1566,36 @@\n d (FF)%09 \n-%0A\n+ %7C%0A%7C\n %5Cn%09 \n@@ -1601,24 +1601,25 @@\n \n+%7C\n ASCII Linefe\n@@ -1627,17 +1627,36 @@\n d (LF)%09 \n-%0A\n+ %7C%0A%7C\n %5Cr%09 \n@@ -1662,24 +1662,25 @@\n \n+%7C\n ASCII Carria\n@@ -1695,17 +1695,28 @@\n n (CR)%09 \n-%0A\n+ %7C%0A%7C\n %5Ct%09 \n@@ -1722,24 +1722,25 @@\n \n+%7C\n ASCII Horizo\n@@ -1755,17 +1755,20 @@\n (TAB)%09 \n-%0A\n+ %7C%0A%7C\n %5Cv%09 \n@@ -1778,16 +1778,17 @@\n \n+%7C\n ASCII Ve\n@@ -1804,17 +1804,36 @@\n b (VT)%09 \n-%0A\n+ %7C%0A%7C\n %5Cooo%09 \n@@ -1829,32 +1829,33 @@\n %7C%0A%7C%5Cooo%09 \n+%7C\n Character with o\n@@ -1865,17 +1865,29 @@\n l value \n-%0A\n+ %7C%0A%7C\n %5Cxhh%09 \n@@ -1891,16 +1891,17 @@\n \n+%7C\n Characte\n@@ -1916,16 +1916,31 @@\n ex value\n+ %7C\n %0A%0A%0A%0A%E8%BF%99%E6%AC%A1%E7%9A%84%E9%A2%98\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://docs.python.org/3.6/reference/lexical_analysis.html\",\"http://tk.hustoj.com/problem.php?id=1008\",\"http://www.voidcn.com/article/p-rxdyqkuo-yq.html\",\"http://blog.csdn.net/sinat_37765046/article/details/72827961\",\"https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\",\"https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1008-ascii-python3-python32018/01/15 23:21:15
spearouspublished a new post: tk-1008-ascii-python3-python3
2018/01/15 23:21:15
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1008-ascii-python3-python3 |
| title | python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出) |
| body | @@ -46,17 +46,20 @@ C++%E4%BB%A3%E7%A0%81%EF%BC%8C%E5%8F%91%E7%8E%B0 -%EF%BC%8C +%E8%83%BD%E9%80%9A%E8%BF%87%E7%9A%84 %E8%BE%93%E5%87%BA%E5%85%B6%E5%AE%9E%E6%98%AF%E5%8F%A6%E4%B8%80%E7%A7%8D @@ -78,16 +78,17 @@ %E6%88%91%E7%9A%84python +3 %E7%A8%8B%E5%BA%8F%E6%8C%89%E7%85%A7%E8%BF%99%E4%B8%AA%E6%96%B0%E7%9A%84 @@ -328,16 +328,23 @@ %E6%88%91%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF:%0A%0A +%E9%81%87%E5%88%B0%E5%A4%9A%E8%A1%8C%E8%BE%93%E5%85%A5%EF%BC%8C %E5%85%88%E7%94%A8input%E8%AF%BB @@ -514,34 +514,16 @@ (lines)%0A -char=text.split()%0A %60%60%60%0A%0A%E5%85%B6%E4%B8%AD%EF%BC%8C @@ -3361,12 +3361,181 @@ break%0A%60%60%60 +%0A%0A%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99%EF%BC%9A%0A1. https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user%0A2. https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["https://docs.python.org/3.6/reference/lexical_analysis.html","http://tk.hustoj.com/problem.php?id=1008","http://www.voidcn.com/article/p-rxdyqkuo-yq.html","http://blog.csdn.net/sinat_37765046/article/details/72827961","https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user","https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012255/Trx 9e956a2587778273a5cae2ee0af1f7de735b59aa |
View Raw JSON Data
{
"trx_id": "9e956a2587778273a5cae2ee0af1f7de735b59aa",
"block": 19012255,
"trx_in_block": 7,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:21:15",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1008-ascii-python3-python3",
"title": "python3刷TK题库 1008: ASCII码 (python3读取多行输入,python3在同一行输出)",
"body": "@@ -46,17 +46,20 @@\n C++%E4%BB%A3%E7%A0%81%EF%BC%8C%E5%8F%91%E7%8E%B0\n-%EF%BC%8C\n+%E8%83%BD%E9%80%9A%E8%BF%87%E7%9A%84\n %E8%BE%93%E5%87%BA%E5%85%B6%E5%AE%9E%E6%98%AF%E5%8F%A6%E4%B8%80%E7%A7%8D\n@@ -78,16 +78,17 @@\n %E6%88%91%E7%9A%84python\n+3\n %E7%A8%8B%E5%BA%8F%E6%8C%89%E7%85%A7%E8%BF%99%E4%B8%AA%E6%96%B0%E7%9A%84\n@@ -328,16 +328,23 @@\n %E6%88%91%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AF:%0A%0A\n+%E9%81%87%E5%88%B0%E5%A4%9A%E8%A1%8C%E8%BE%93%E5%85%A5%EF%BC%8C\n %E5%85%88%E7%94%A8input%E8%AF%BB\n@@ -514,34 +514,16 @@\n (lines)%0A\n-char=text.split()%0A\n %60%60%60%0A%0A%E5%85%B6%E4%B8%AD%EF%BC%8C\n@@ -3361,12 +3361,181 @@\n break%0A%60%60%60\n+%0A%0A%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99%EF%BC%9A%0A1. https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user%0A2. https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"https://docs.python.org/3.6/reference/lexical_analysis.html\",\"http://tk.hustoj.com/problem.php?id=1008\",\"http://www.voidcn.com/article/p-rxdyqkuo-yq.html\",\"http://blog.csdn.net/sinat_37765046/article/details/72827961\",\"https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user\",\"https://stackoverflow.com/questions/3249524/print-in-one-line-dynamically\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1006-a-b-vii2018/01/15 23:12:27
spearouspublished a new post: tk-1006-a-b-vii
2018/01/15 23:12:27
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1006-a-b-vii |
| title | python3刷TK题库 1006: A+B 输入输出练习VII |
| body | 这个输入输出和前面的一个题目差不多,就是输出多了一行空行。所以改一下代码即可。 http://tk.hustoj.com/problem.php?id=1006 1006: A+B 输入输出练习VII 时间限制: 1 Sec 内存限制: 32 MB 提交: 4357 解决: 2775 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 你的任务是计算两个整数的和。 输入 输入包含若干行,每行输入两个整数a和b,由空格分隔。 输出 对于每组输入,输出a和b的和,每行输出后接一个空行。 样例输入 1 5 10 20 样例输出 6 30 我的python3 ``` while True: A,B = input().split() if A == '': break C=int(A)+int(B) print(C) print("\n") ``` 附一个C++ ``` #include "iostream" using namespace std; int main() { int a,b; while(cin>>a>>b) { cout<<a+b<<endl<<endl; } return 0; } ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1006"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012079/Trx 63c3f29ad611633ad85be8a239cc84253f15c3f0 |
View Raw JSON Data
{
"trx_id": "63c3f29ad611633ad85be8a239cc84253f15c3f0",
"block": 19012079,
"trx_in_block": 8,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:12:27",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1006-a-b-vii",
"title": "python3刷TK题库 1006: A+B 输入输出练习VII",
"body": "这个输入输出和前面的一个题目差不多,就是输出多了一行空行。所以改一下代码即可。\n\n\nhttp://tk.hustoj.com/problem.php?id=1006\n\n1006: A+B 输入输出练习VII\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 4357 解决: 2775\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n你的任务是计算两个整数的和。\n输入\n输入包含若干行,每行输入两个整数a和b,由空格分隔。\n输出\n对于每组输入,输出a和b的和,每行输出后接一个空行。\n样例输入\n1 5\n10 20\n样例输出\n6\n\n30\n\n\n我的python3\n\n```\nwhile True:\n A,B = input().split()\n if A == '':\n break\n C=int(A)+int(B)\n print(C)\n print(\"\\n\")\n```\n\n附一个C++\n```\n#include \"iostream\"\n \nusing namespace std; \n \nint main() \n{ \n int a,b; \n while(cin>>a>>b) \n { \n cout<<a+b<<endl<<endl; \n } \n return 0; \n}\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1006\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1005-a-b-vi2018/01/15 23:11:54
spearouspublished a new post: tk-1005-a-b-vi
2018/01/15 23:11:54
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1005-a-b-vi |
| title | python3刷TK题库 1005: A+B 输入输出练习VI |
| body | @@ -28,16 +28,58 @@ %E4%B9%9F%E8%BF%87%E4%BA%86%E3%80%82%E3%80%82%E3%80%82%0A%0A +http://tk.hustoj.com/problem.php?id=1005%0A%0A 1005: A+ |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown","links":["http://tk.hustoj.com/problem.php?id=1005"]} |
| Transaction Info | Block #19012068/Trx b6f41e8bb6c79a484bf007f877a1c218b2432805 |
View Raw JSON Data
{
"trx_id": "b6f41e8bb6c79a484bf007f877a1c218b2432805",
"block": 19012068,
"trx_in_block": 38,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:11:54",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1005-a-b-vi",
"title": "python3刷TK题库 1005: A+B 输入输出练习VI",
"body": "@@ -28,16 +28,58 @@\n %E4%B9%9F%E8%BF%87%E4%BA%86%E3%80%82%E3%80%82%E3%80%82%0A%0A\n+http://tk.hustoj.com/problem.php?id=1005%0A%0A\n 1005: A+\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"http://tk.hustoj.com/problem.php?id=1005\"]}"
}
]
}spearouspublished a new post: tk-1004-a-b-v2018/01/15 23:11:27
spearouspublished a new post: tk-1004-a-b-v
2018/01/15 23:11:27
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1004-a-b-v |
| title | python3刷TK题库 1004: A+B 输入输出练习V |
| body | 实际上,这个是前几个输入输出问题的合并。所以只要改一下代码即可。 1004: A+B 输入输出练习V 时间限制: 1 Sec 内存限制: 32 MB 提交: 5469 解决: 3620 [提交][状态][讨论版][命题人:外部导入][下载1元][32kb] 题目描述 你的任务是计算若干整数的和。 输入 输入的第一行是一个正数N,表示后面有N行。每一行的第一个数是M,表示本行后面还有M个数。 输出 对于每一行数据需要在相应的行输出和。 样例输入 2 4 1 2 3 4 5 1 2 3 4 5 样例输出 10 15 提示 我的python3代码: ``` number_of_input_line=int(input()) for i in range(0,number_of_input_line): sum_of_input=0 std_input=input() if (int(std_input.split()[0])==0): break else: for i in range(1, int(std_input.split()[0])+1): sum_of_input = sum_of_input + int(std_input.split()[i]) print(sum_of_input) ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19012059/Trx 75e424aaf54a571a454342ca77d0371fee0a08da |
View Raw JSON Data
{
"trx_id": "75e424aaf54a571a454342ca77d0371fee0a08da",
"block": 19012059,
"trx_in_block": 4,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:11:27",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1004-a-b-v",
"title": "python3刷TK题库 1004: A+B 输入输出练习V",
"body": "实际上,这个是前几个输入输出问题的合并。所以只要改一下代码即可。\n\n1004: A+B 输入输出练习V\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 5469 解决: 3620\n[提交][状态][讨论版][命题人:外部导入][下载1元][32kb]\n题目描述\n你的任务是计算若干整数的和。\n\n输入\n输入的第一行是一个正数N,表示后面有N行。每一行的第一个数是M,表示本行后面还有M个数。\n\n输出\n对于每一行数据需要在相应的行输出和。\n\n样例输入\n2\n4 1 2 3 4\n5 1 2 3 4 5\n样例输出\n10\n15\n提示\n\n\n我的python3代码:\n```\nnumber_of_input_line=int(input())\nfor i in range(0,number_of_input_line):\n sum_of_input=0\n std_input=input()\n if (int(std_input.split()[0])==0):\n break\n else:\n for i in range(1, int(std_input.split()[0])+1):\n sum_of_input = sum_of_input + int(std_input.split()[i])\n print(sum_of_input)\n\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1003-a-b-iv2018/01/15 23:10:51
spearouspublished a new post: tk-1003-a-b-iv
2018/01/15 23:10:51
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1003-a-b-iv |
| title | python3刷TK题库 1003: A+B 输入输出练习IV |
| body | @@ -55,16 +55,24 @@ %E9%9A%94%E7%AC%A6%EF%BC%88%E9%BB%98%E8%AE%A4%E4%B8%BA%E7%A9%BA%E6%A0%BC +%EF%BC%8C%E5%88%B6%E8%A1%A8%E7%AC%A6%E5%92%8C%E6%8D%A2%E8%A1%8C%E9%94%AE %EF%BC%89%EF%BC%8C%E5%88%86%E5%88%AB%E5%AD%98%E8%BF%9B%E4%B8%8D%E5%90%8C @@ -137,16 +137,69 @@ %EF%BC%89%E5%AD%98%E8%BF%9Ba%E9%87%8C%E3%80%82%0A%0A +%E5%BD%93%E7%84%B6%E4%B9%9F%E5%8F%AF%E4%BB%A5%E6%8C%87%E5%AE%9A%E5%88%86%E9%9A%94%E7%AC%A6%EF%BC%8C%E5%A6%82%E7%94%A8%22-%22%EF%BC%9A%0Aa=line.split('-')%5Bb%5D%0A%0A%E8%BF%99%E6%AC%A1%E7%9A%84%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E9%A2%98%E7%9B%AE%E5%9C%A8%EF%BC%9A%0A%0A http://t |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown","links":["http://tk.hustoj.com/problem.php?id=1003"]} |
| Transaction Info | Block #19012047/Trx bd5f2c6c2e8eced50c7d48fc041c9c730f2c09b7 |
View Raw JSON Data
{
"trx_id": "bd5f2c6c2e8eced50c7d48fc041c9c730f2c09b7",
"block": 19012047,
"trx_in_block": 16,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:10:51",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1003-a-b-iv",
"title": "python3刷TK题库 1003: A+B 输入输出练习IV",
"body": "@@ -55,16 +55,24 @@\n %E9%9A%94%E7%AC%A6%EF%BC%88%E9%BB%98%E8%AE%A4%E4%B8%BA%E7%A9%BA%E6%A0%BC\n+%EF%BC%8C%E5%88%B6%E8%A1%A8%E7%AC%A6%E5%92%8C%E6%8D%A2%E8%A1%8C%E9%94%AE\n %EF%BC%89%EF%BC%8C%E5%88%86%E5%88%AB%E5%AD%98%E8%BF%9B%E4%B8%8D%E5%90%8C\n@@ -137,16 +137,69 @@\n %EF%BC%89%E5%AD%98%E8%BF%9Ba%E9%87%8C%E3%80%82%0A%0A\n+%E5%BD%93%E7%84%B6%E4%B9%9F%E5%8F%AF%E4%BB%A5%E6%8C%87%E5%AE%9A%E5%88%86%E9%9A%94%E7%AC%A6%EF%BC%8C%E5%A6%82%E7%94%A8%22-%22%EF%BC%9A%0Aa=line.split('-')%5Bb%5D%0A%0A%E8%BF%99%E6%AC%A1%E7%9A%84%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E9%A2%98%E7%9B%AE%E5%9C%A8%EF%BC%9A%0A%0A\n http://t\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"http://tk.hustoj.com/problem.php?id=1003\"]}"
}
]
}spearouspublished a new post: tk-1003-a-b-iv2018/01/15 23:08:09
spearouspublished a new post: tk-1003-a-b-iv
2018/01/15 23:08:09
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1003-a-b-iv |
| title | python3刷TK题库 1003: A+B 输入输出练习IV |
| body | 这算是第四个用input的题目了,这里有个小技巧,就是用split()函数把一行输入的若干个数,按照给定的分隔符(默认为空格),分别存进不同的变量里。而这些变量可以用数组来组织,调用的时候用: a=line.split()[b] 即把第b个数(从零开始计算)存进a里。 http://tk.hustoj.com/problem.php?id=1003 1003: A+B 输入输出练习IV 时间限制: 1 Sec 内存限制: 32 MB 提交: 8551 解决: 4435 [提交][状态][讨论版][命题人:外部导入][下载1元][32kb] 题目描述 你的任务是计算若干整数的和。 输入 每行的第一个数N,表示本行后面有N个数。 如果N=0时,表示输入结束,且这一行不要计算。 输出 对于每一行数据需要在相应的行输出和。 样例输入 4 1 2 3 4 5 1 2 3 4 5 0 样例输出 10 15 我的python3 ``` while True: sum_of_input=0 std_input=input() if (int(std_input.split()[0])==0): break else: for i in range(1, int(std_input.split()[0])+1): sum_of_input = sum_of_input + int(std_input.split()[i]) print(sum_of_input) ``` 附一个c++程序: ``` using namespace std; int main(){ int N,a; while (cin>>N) { int sum = 0; while (N--) { cin>>a; sum+=a; } cout<<sum<<endl; } return 0; } ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"app":"steemit/0.1","format":"markdown","links":["http://tk.hustoj.com/problem.php?id=1003"]} |
| Transaction Info | Block #19011993/Trx 0c90d47e3ee0a19a4a94fdebed913d106ae7bf58 |
View Raw JSON Data
{
"trx_id": "0c90d47e3ee0a19a4a94fdebed913d106ae7bf58",
"block": 19011993,
"trx_in_block": 19,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:08:09",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1003-a-b-iv",
"title": "python3刷TK题库 1003: A+B 输入输出练习IV",
"body": "这算是第四个用input的题目了,这里有个小技巧,就是用split()函数把一行输入的若干个数,按照给定的分隔符(默认为空格),分别存进不同的变量里。而这些变量可以用数组来组织,调用的时候用:\na=line.split()[b]\n即把第b个数(从零开始计算)存进a里。\n\nhttp://tk.hustoj.com/problem.php?id=1003\n\n1003: A+B 输入输出练习IV\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 8551 解决: 4435\n[提交][状态][讨论版][命题人:外部导入][下载1元][32kb]\n题目描述\n你的任务是计算若干整数的和。\n\n输入\n每行的第一个数N,表示本行后面有N个数。\n\n如果N=0时,表示输入结束,且这一行不要计算。\n\n输出\n对于每一行数据需要在相应的行输出和。\n\n样例输入\n4 1 2 3 4\n5 1 2 3 4 5\n0 \n样例输出\n10\n15\n\n我的python3\n```\nwhile True:\n sum_of_input=0\n std_input=input()\n if (int(std_input.split()[0])==0):\n break\n else:\n for i in range(1, int(std_input.split()[0])+1):\n sum_of_input = sum_of_input + int(std_input.split()[i])\n print(sum_of_input)\n```\n附一个c++程序:\n```\nusing namespace std; \nint main(){ \n int N,a; \n while (cin>>N) \n { \n int sum = 0; \n while (N--) \n { \n cin>>a; \n sum+=a; \n } \n cout<<sum<<endl; \n } \n return 0; \n}\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"http://tk.hustoj.com/problem.php?id=1003\"]}"
}
]
}spearouspublished a new post: tk-1001-a-b-iii2018/01/15 23:07:51
spearouspublished a new post: tk-1001-a-b-iii
2018/01/15 23:07:51
| parent author | |
| parent permlink | cn |
| author | spearous |
| permlink | tk-1001-a-b-iii |
| title | python3刷TK题库 1002: A+B 输入输出练习III |
| body | 第三个输入输出, http://tk.hustoj.com/problem.php?id=1002 1002: A+B 输入输出练习III 时间限制: 1 Sec 内存限制: 32 MB 提交: 7505 解决: 4943 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 你的任务是计算a+b。 输入 输入中每行是一对a和b。其中会有一对是0和0标志着输入结束,且这一对不要计算。 输出 对于输入的每对a和b,你需要在相应的行输出a、b的和。 如第二对a和b,他们的和也输出在第二行。 样例输入 1 5 10 20 0 0 样例输出 6 30 我的python3 ``` while True: a,b=input().split() if int(a) == 0 or int(b) ==0: break c=int(a)+int(b) print(c) ``` 附一个c版本: ``` #include<stdio.h> int main() {int a,b; while(scanf("%d%d",&a,&b)!=EOF &&a!=0&&b!=0) {printf("%d\n",a+b); } return 0; } ``` |
| json metadata | {"tags":["cn","cn-reader","acm","tk","python"],"app":"steemit/0.1","format":"markdown","links":["http://tk.hustoj.com/problem.php?id=1002"]} |
| Transaction Info | Block #19011987/Trx 11ecd29a6b9664f1fd07c6077f2c8cb93b0353cc |
View Raw JSON Data
{
"trx_id": "11ecd29a6b9664f1fd07c6077f2c8cb93b0353cc",
"block": 19011987,
"trx_in_block": 6,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:07:51",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "cn",
"author": "spearous",
"permlink": "tk-1001-a-b-iii",
"title": "python3刷TK题库 1002: A+B 输入输出练习III",
"body": "第三个输入输出,\n\nhttp://tk.hustoj.com/problem.php?id=1002\n\n1002: A+B 输入输出练习III\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 7505 解决: 4943\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n你的任务是计算a+b。\n\n输入\n输入中每行是一对a和b。其中会有一对是0和0标志着输入结束,且这一对不要计算。\n\n输出\n对于输入的每对a和b,你需要在相应的行输出a、b的和。\n如第二对a和b,他们的和也输出在第二行。\n样例输入\n1 5\n10 20\n0 0\n样例输出\n6\n30\n\n我的python3\n```\nwhile True:\n a,b=input().split()\n if int(a) == 0 or int(b) ==0:\n break\n c=int(a)+int(b)\n print(c)\n```\n附一个c版本:\n```\n#include<stdio.h>\nint main()\n{int a,b;\n while(scanf(\"%d%d\",&a,&b)!=EOF &&a!=0&&b!=0)\n {printf(\"%d\\n\",a+b);\n }\nreturn 0;\n}\n```",
"json_metadata": "{\"tags\":[\"cn\",\"cn-reader\",\"acm\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"http://tk.hustoj.com/problem.php?id=1002\"]}"
}
]
}spearouspublished a new post: tk-1001-a-b-ii2018/01/15 23:07:24
spearouspublished a new post: tk-1001-a-b-ii
2018/01/15 23:07:24
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1001-a-b-ii |
| title | python3刷TK题库 1001: A+B 输入输出练习II |
| body | 这个是另一个基本求和问题。我觉得这个题目描述就很清晰。所以,也很简单的AC了。 http://tk.hustoj.com/problem.php?id=1001 1001: A+B 输入输出练习II 时间限制: 1 Sec 内存限制: 32 MB 提交: 9560 解决: 5632 [提交][状态][讨论版][命题人:外部导入][下载1元][20kb] 题目描述 你的任务是计算a+b。 输入 第一行是一个整数N,表示后面会有N行a和b,通过空格隔开。 输出 对于输入的每对a和b,你需要在相应的行输出a、b的和。 如第二对a和b,对应的和也输出在第二行。 样例输入 2 1 5 10 20 样例输出 6 30 我的是python3程序 ``` number_of_input_line=int(input()) for i in range(0,number_of_input_line): a,b=input().split() sum_of_input=int(a)+int(b) print(sum_of_input) ``` 也附一个C程序: ``` #include<stdio.h> int main() { int a,b,c; scanf("%d",&c); while(c--) { scanf("%d%d",&a,&b); printf("%d\n",a+b); } return 0; } ``` |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1001"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19011978/Trx b1bbf180b10f1a6cf83ff41b0496e98b714ec491 |
View Raw JSON Data
{
"trx_id": "b1bbf180b10f1a6cf83ff41b0496e98b714ec491",
"block": 19011978,
"trx_in_block": 20,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:07:24",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1001-a-b-ii",
"title": "python3刷TK题库 1001: A+B 输入输出练习II",
"body": "这个是另一个基本求和问题。我觉得这个题目描述就很清晰。所以,也很简单的AC了。\n\nhttp://tk.hustoj.com/problem.php?id=1001\n\n1001: A+B 输入输出练习II\n时间限制: 1 Sec 内存限制: 32 MB\n提交: 9560 解决: 5632\n[提交][状态][讨论版][命题人:外部导入][下载1元][20kb]\n题目描述\n你的任务是计算a+b。\n\n输入\n第一行是一个整数N,表示后面会有N行a和b,通过空格隔开。\n\n输出\n对于输入的每对a和b,你需要在相应的行输出a、b的和。\n如第二对a和b,对应的和也输出在第二行。\n样例输入\n2\n1 5\n10 20\n样例输出\n6\n30\n\n\n我的是python3程序\n```\nnumber_of_input_line=int(input())\nfor i in range(0,number_of_input_line):\n a,b=input().split()\n sum_of_input=int(a)+int(b)\n print(sum_of_input)\n\n```\n也附一个C程序:\n```\n#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d\",&c);\n while(c--)\n { scanf(\"%d%d\",&a,&b);\n printf(\"%d\\n\",a+b);\n }\nreturn 0;\n\n}\n```",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1001\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1000-a-b-i2018/01/15 23:07:03
spearouspublished a new post: tk-1000-a-b-i
2018/01/15 23:07:03
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1000-a-b-i |
| title | python3刷TK题库 1000: A+B 输入输出练习I (初次接触input()) |
| body | @@ -229,16 +229,167 @@ ())%E8%BF%9B%E8%A1%8C%E8%BD%AC%E6%8D%A2%E3%80%82 +%E5%AE%9E%E9%99%85%E4%B8%8A%EF%BC%8C%E5%9C%A8python2%E4%B8%AD%E5%8E%9F%E6%9D%A5%E6%9C%89raw_input()%E5%92%8Cinput()%E4%B8%A4%E7%A7%8D%E5%A4%84%E7%90%86%E8%BE%93%E5%85%A5%E7%9A%84%E5%87%BD%E6%95%B0%EF%BC%8C%E5%90%8E%E6%9D%A5%E5%9B%A0%E4%B8%BA%E5%AE%89%E5%85%A8%E6%80%A7%E5%8E%9F%E5%9B%A0%EF%BC%88%E5%9B%A0%E4%B8%BAraw_input()%E7%94%9A%E8%87%B3%E5%85%81%E8%AE%B8%E8%BE%93%E5%85%A5%E6%98%AF%E4%B8%80%E4%B8%AApython%E8%A1%A8%E8%BE%BE%E5%BC%8F%EF%BC%89%EF%BC%8C%E5%9C%A8python3%E4%B8%AD%E5%8E%BB%E6%8E%89%E4%BA%86%E5%8E%9F%E6%9D%A5python2%E7%9A%84input()%EF%BC%8C%E8%80%8C%E6%8A%8Araw_input()%E5%88%A0%E6%8E%89%E8%A1%A8%E8%BE%BE%E5%BC%8F%E8%BF%99%E9%83%A8%E5%88%86%E8%80%8C%E6%94%B9%E5%90%8D%E4%B8%BAinput(). %0A%0A%0Ahttp: @@ -883,8 +883,191 @@ urn 0;%0A%7D +%0A%0A%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99%0A1. https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x%0A%0A2. http://blog.csdn.net/suibianshen2012/article/details/51378948 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1000","https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x","http://blog.csdn.net/suibianshen2012/article/details/51378948"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19011971/Trx fd6d94a56821fd6ce0dbd0811dc92be17b092388 |
View Raw JSON Data
{
"trx_id": "fd6d94a56821fd6ce0dbd0811dc92be17b092388",
"block": 19011971,
"trx_in_block": 18,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:07:03",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1000-a-b-i",
"title": "python3刷TK题库 1000: A+B 输入输出练习I (初次接触input())",
"body": "@@ -229,16 +229,167 @@\n ())%E8%BF%9B%E8%A1%8C%E8%BD%AC%E6%8D%A2%E3%80%82\n+%E5%AE%9E%E9%99%85%E4%B8%8A%EF%BC%8C%E5%9C%A8python2%E4%B8%AD%E5%8E%9F%E6%9D%A5%E6%9C%89raw_input()%E5%92%8Cinput()%E4%B8%A4%E7%A7%8D%E5%A4%84%E7%90%86%E8%BE%93%E5%85%A5%E7%9A%84%E5%87%BD%E6%95%B0%EF%BC%8C%E5%90%8E%E6%9D%A5%E5%9B%A0%E4%B8%BA%E5%AE%89%E5%85%A8%E6%80%A7%E5%8E%9F%E5%9B%A0%EF%BC%88%E5%9B%A0%E4%B8%BAraw_input()%E7%94%9A%E8%87%B3%E5%85%81%E8%AE%B8%E8%BE%93%E5%85%A5%E6%98%AF%E4%B8%80%E4%B8%AApython%E8%A1%A8%E8%BE%BE%E5%BC%8F%EF%BC%89%EF%BC%8C%E5%9C%A8python3%E4%B8%AD%E5%8E%BB%E6%8E%89%E4%BA%86%E5%8E%9F%E6%9D%A5python2%E7%9A%84input()%EF%BC%8C%E8%80%8C%E6%8A%8Araw_input()%E5%88%A0%E6%8E%89%E8%A1%A8%E8%BE%BE%E5%BC%8F%E8%BF%99%E9%83%A8%E5%88%86%E8%80%8C%E6%94%B9%E5%90%8D%E4%B8%BAinput().\n %0A%0A%0Ahttp:\n@@ -883,8 +883,191 @@\n urn 0;%0A%7D\n+%0A%0A%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99%0A1. https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x%0A%0A2. http://blog.csdn.net/suibianshen2012/article/details/51378948\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1000\",\"https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x\",\"http://blog.csdn.net/suibianshen2012/article/details/51378948\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1001-a-b-ii2018/01/15 23:01:27
spearouspublished a new post: tk-1001-a-b-ii
2018/01/15 23:01:27
| parent author | |
| parent permlink | acm |
| author | spearous |
| permlink | tk-1001-a-b-ii |
| title | TK题库 1001: A+B 输入输出练习II |
| body | @@ -321,11 +321,15 @@ thon +3 %E7%A8%8B%E5%BA%8F%0A +%60%60%60 %0Anum @@ -479,17 +479,20 @@ input)%0A%0A +%60%60%60 %0A - %E4%B9%9F%E9%99%84%E4%B8%80%E4%B8%AAC%E7%A8%8B%E5%BA%8F%EF%BC%9A @@ -492,17 +492,20 @@ %E9%99%84%E4%B8%80%E4%B8%AAC%E7%A8%8B%E5%BA%8F%EF%BC%9A%0A +%60%60%60 %0A - #include @@ -644,9 +644,13 @@ urn 0;%0A%0A - %7D +%0A%60%60%60 |
| json metadata | {"tags":["acm","cn","cn-reader","tk","python"],"links":["http://tk.hustoj.com/problem.php?id=1001"],"app":"steemit/0.1","format":"markdown"} |
| Transaction Info | Block #19011859/Trx b0b7537f78269b51ffd082cfcdfec1172f274eb7 |
View Raw JSON Data
{
"trx_id": "b0b7537f78269b51ffd082cfcdfec1172f274eb7",
"block": 19011859,
"trx_in_block": 26,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:01:27",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "acm",
"author": "spearous",
"permlink": "tk-1001-a-b-ii",
"title": "TK题库 1001: A+B 输入输出练习II",
"body": "@@ -321,11 +321,15 @@\n thon\n+3\n %E7%A8%8B%E5%BA%8F%0A\n+%60%60%60\n %0Anum\n@@ -479,17 +479,20 @@\n input)%0A%0A\n+%60%60%60\n %0A\n-\n %E4%B9%9F%E9%99%84%E4%B8%80%E4%B8%AAC%E7%A8%8B%E5%BA%8F%EF%BC%9A\n@@ -492,17 +492,20 @@\n %E9%99%84%E4%B8%80%E4%B8%AAC%E7%A8%8B%E5%BA%8F%EF%BC%9A%0A\n+%60%60%60\n %0A\n-\n #include\n@@ -644,9 +644,13 @@\n urn 0;%0A%0A\n-\n %7D\n+%0A%60%60%60\n",
"json_metadata": "{\"tags\":[\"acm\",\"cn\",\"cn-reader\",\"tk\",\"python\"],\"links\":[\"http://tk.hustoj.com/problem.php?id=1001\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}"
}
]
}spearouspublished a new post: tk-1001-a-b-iii2018/01/15 23:00:54
spearouspublished a new post: tk-1001-a-b-iii
2018/01/15 23:00:54
| parent author | |
| parent permlink | cn |
| author | spearous |
| permlink | tk-1001-a-b-iii |
| title | TK题库 1002: A+B 输入输出练习III |
| body | @@ -3,16 +3,57 @@ %E4%B8%AA%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%EF%BC%8C%0A%0A +http://tk.hustoj.com/problem.php?id=1002%0A %0A1002: A @@ -299,17 +299,20 @@ python3%0A +%60%60%60 %0A - while Tr @@ -424,18 +424,24 @@ (c)%0A +%60%60%60 %0A - %E9%99%84%E4%B8%80%E4%B8%AAc%E7%89%88%E6%9C%AC%EF%BC%9A%0A +%60%60%60 %0A - #inc @@ -556,9 +556,13 @@ turn 0;%0A - %7D +%0A%60%60%60 |
| json metadata | {"tags":["cn","cn-reader","acm","tk","python"],"app":"steemit/0.1","format":"markdown","links":["http://tk.hustoj.com/problem.php?id=1002"]} |
| Transaction Info | Block #19011848/Trx 13307f9ddb1e819b39304b270db6f25388d6a686 |
View Raw JSON Data
{
"trx_id": "13307f9ddb1e819b39304b270db6f25388d6a686",
"block": 19011848,
"trx_in_block": 44,
"op_in_trx": 0,
"virtual_op": 0,
"timestamp": "2018-01-15T23:00:54",
"op": [
"comment",
{
"parent_author": "",
"parent_permlink": "cn",
"author": "spearous",
"permlink": "tk-1001-a-b-iii",
"title": "TK题库 1002: A+B 输入输出练习III",
"body": "@@ -3,16 +3,57 @@\n %E4%B8%AA%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%EF%BC%8C%0A%0A\n+http://tk.hustoj.com/problem.php?id=1002%0A\n %0A1002: A\n@@ -299,17 +299,20 @@\n python3%0A\n+%60%60%60\n %0A\n-\n while Tr\n@@ -424,18 +424,24 @@\n (c)%0A\n+%60%60%60\n %0A\n-\n %E9%99%84%E4%B8%80%E4%B8%AAc%E7%89%88%E6%9C%AC%EF%BC%9A%0A\n+%60%60%60\n %0A\n-\n #inc\n@@ -556,9 +556,13 @@\n turn 0;%0A\n-\n %7D\n+%0A%60%60%60\n",
"json_metadata": "{\"tags\":[\"cn\",\"cn-reader\",\"acm\",\"tk\",\"python\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\",\"links\":[\"http://tk.hustoj.com/problem.php?id=1002\"]}"
}
]
}Manabar
Voting Power100.00%
Downvote Power100.00%
Resource Credits100.00%
Reputation Progress58.81%
{
"voting_manabar": {
"current_mana": "8143659806",
"last_update_time": 1779086835
},
"downvote_manabar": {
"current_mana": 2035914951,
"last_update_time": 1779086835
},
"rc_account": {
"account": "spearous",
"rc_manabar": {
"current_mana": "10164408779",
"last_update_time": 1779086835
},
"max_rc_creation_adjustment": {
"amount": "2020748973",
"precision": 6,
"nai": "@@000000037"
},
"max_rc": "10164408779"
}
}Account Metadata
| POSTING JSON METADATA | |
| None | |
| JSON METADATA | |
| None |
{
"posting_json_metadata": {},
"json_metadata": {}
}Auth Keys
Owner
Single Signature
Public Keys
STM5y6db2uXx1myvFcPct7u2cLZQUXCUqBboyKQuVQpFJDEhiapB31/1
Active
Single Signature
Public Keys
STM7JWKsQN1P8pQWqETmvGJBxkMHCegFTsr5s5AhmpAo6vyLHpgqo1/1
Posting
Single Signature
Public Keys
STM5pSxHFF6XAAiLD6gG6tHFgkGudtZwsH1ZZa4cFHMoEGM6DzWfB1/1
Memo
STM5472ugYPvsya3ZfV9brFUu7uop8SMNJ5hyKuF7f5iuN8R77xBW
{
"owner": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5y6db2uXx1myvFcPct7u2cLZQUXCUqBboyKQuVQpFJDEhiapB3",
1
]
]
},
"active": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM7JWKsQN1P8pQWqETmvGJBxkMHCegFTsr5s5AhmpAo6vyLHpgqo",
1
]
]
},
"posting": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [
[
"STM5pSxHFF6XAAiLD6gG6tHFgkGudtZwsH1ZZa4cFHMoEGM6DzWfB",
1
]
]
},
"memo": "STM5472ugYPvsya3ZfV9brFUu7uop8SMNJ5hyKuF7f5iuN8R77xBW"
}Witness Votes
0 / 30
No active witness votes.
[]