锘??xml version="1.0" encoding="utf-8" standalone="yes"?>人妻精品久久久久中文字幕,久久香蕉综合色一综合色88,国产福利电影一区二区三区,免费久久久久久久精 http://www.shnenglu.com/ivy-jie/category/10522.htmlprogress ...zh-cnSat, 23 May 2009 02:59:03 GMTSat, 23 May 2009 02:59:03 GMT60200511 閲嶅彔鍖洪棿澶у皬http://www.shnenglu.com/ivy-jie/articles/83630.htmlivy-jieivy-jieThu, 21 May 2009 16:08:00 GMThttp://www.shnenglu.com/ivy-jie/articles/83630.htmlhttp://www.shnenglu.com/ivy-jie/comments/83630.htmlhttp://www.shnenglu.com/ivy-jie/articles/83630.html#Feedback0http://www.shnenglu.com/ivy-jie/comments/commentRss/83630.htmlhttp://www.shnenglu.com/ivy-jie/services/trackbacks/83630.html
    瀵逛竴涓鏁存暟 n 錛屽鏋?n 鍦ㄦ暟鎹枃浠朵腑鏌愯鐨勪袱涓鏁存暟錛堝亣璁句負 A 鍜?B 錛変箣闂達紝鍗?A<=n<=B 鎴?A>=n>=B 錛屽垯 n 灞炰簬璇ヨ錛涘鏋?n 鍚屾椂   灞炰簬琛?i 鍜?j 錛屽垯 i 鍜?j 鏈夐噸鍙犲尯闂達紱閲嶅彔鍖洪棿鐨勫ぇ灝忔槸鍚屾椂灞炰簬琛?i 鍜?j 鐨勬暣鏁頒釜鏁般?nbsp;
  
   渚嬪錛岃錛?10 20 錛夊拰錛?12 25 錛夌殑閲嶅彔鍖洪棿涓?[12 20] 錛屽叾澶у皬涓?9 錛涜錛?20 10 錛夊拰錛?12 18 錛夌殑閲嶅彔鍖洪棿涓?[10 12] 錛屽叾澶у皬涓?3 錛涜 (20 10) 鍜岋紙 20 30 錛夌殑閲嶅彔鍖洪棿澶у皬涓?1 銆?br>
  杈撳叆鏁版嵁錛氱▼搴忚鍏ュ凡琚懡鍚嶄負 input.txt 鐨勮緭鍏ユ暟鎹枃鏈枃浠訛紝璇ユ枃浠剁殑琛屾暟鍦?1 鍒?1,000,000 涔嬮棿錛屾瘡琛屾湁鐢ㄤ竴涓┖鏍煎垎闅旂殑 2 涓鏁存暟錛岃繖 2 涓鏁存暟鐨勫ぇ灝忔搴忛殢鏈猴紝姣忎釜鏁伴兘鍦?1 鍜?2^32-1 涔嬮棿銆傦紙涓轟究浜庤皟璇曪紝鎮ㄥ彲涓嬭澆嫻嬭瘯 input.txt 鏂囦歡錛屽疄闄呰繍琛屾椂鎴戜滑浼氫嬌鐢ㄤ笉鍚屽唴瀹圭殑杈撳叆鏂囦歡銆傦級

  杈撳嚭鏁版嵁錛氬湪鏍囧噯杈撳嚭涓婃墦鍗板嚭杈撳叆鏁版嵁鏂囦歡涓渶澶ч噸鍙犲尯闂寸殑澶у皬錛屽鏋滄墍鏈夎閮芥病鏈夐噸鍙犲尯闂達紝鍒欒緭鍑?0 銆?

  璇勫垎鏍囧噯錛氱▼搴忚緭鍑虹粨鏋滃繀欏繪紜紝鍐呭瓨浣跨敤蹇呴』涓嶈秴榪?256MB 錛岀▼搴忕殑鎵ц鏃墮棿瓚婂揩瓚婂ソ銆?
2 #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
typedef struct {int x,y,l;} Sec;
const int MAXN= 1000003;
int n,l;
Sec sec[MAXN];
int cmp(const void *a,const void *b)
{
 return (*((Sec *)a)).x-(*((Sec *)b)).x;
}
int main()
{
  int i,j,k,t;
  freopen("input.txt","r",stdin);
  n=0,l=0;
  while(scanf("%d%d",&sec[n].x,&sec[n].y)!=EOF)
  {
   if(sec[n].x>sec[n].y) t=sec[n].x,sec[n].x=sec[n].y,sec[n].y=t;
   sec[n].l=sec[n].y-sec[n].x+1;
   n++;
 
  }
  qsort(sec,n,sizeof(Sec),cmp);
  for(i=0;i<n;i++)
  {
   if(sec[i].x == -1) continue;
   for(j=i+1;j<n;j++)
   {
    if(sec[j].x > sec[i].y) break; //鑲畾涓嶄細閲嶅彔
    if(sec[j].x == -1 || sec[j].y>sec[i].y) continue;
    if(sec[j].l>l) l=sec[j].l;//sec[i]瀹屽叏鍖呮嫭sec[j]
    sec[j].x = -1; //宸茬粡鑰冭檻榪?br>   }
  }
  for(i=0;i<n;i++)
  {
    if(sec[i].x == -1) continue;
 for(j=i+1;j<n;j++)
 {
   if(sec[j].x > sec[i].y) break;
   if(sec[j].x == -1) continue;
   if(sec[i].y - sec[j].x +1 >l) l =sec[i].y-sec[j].x+1;
   break;
 }
  }
  cout<<l<<endl;
  return 0;
}


ivy-jie 2009-05-22 00:08 鍙戣〃璇勮
]]>
鍏充簬姹夊瓧gbk緙栫爜http://www.shnenglu.com/ivy-jie/articles/83624.htmlivy-jieivy-jieThu, 21 May 2009 15:31:00 GMThttp://www.shnenglu.com/ivy-jie/articles/83624.htmlhttp://www.shnenglu.com/ivy-jie/comments/83624.htmlhttp://www.shnenglu.com/ivy-jie/articles/83624.html#Feedback0http://www.shnenglu.com/ivy-jie/comments/commentRss/83624.htmlhttp://www.shnenglu.com/ivy-jie/services/trackbacks/83624.html姹夊瓧鐨凣BK緙栫爜涔熸槸鎶婁竴涓眽瀛楃敤涓や釜瀛楄妭鏉ヨ〃紺猴紝鍏墮瀛楄妭瀵瑰簲0x81-0xFE(鍗?29-224)錛屽熬瀛楄妭瀵瑰簲闄ゆ帀(0x7F)鐨?x40-oxFE(鍗?4-126鍜?28-224)

鎴戜滑涓鑸垽鏂竴涓瓧鏄惁鏄眽瀛楅兘鏄牴鎹叾棣栧瓧鑺傛潵鍒ゆ柇錛屾垜浠潵鐪嬫眽瀛楃殑GBK緙栫爜棣栧瓧鑺傜殑璧峰緙栫爜0x81錛屽叾浜岃繘鍒跺嵆涓?000 1000 0000 0000錛?鍙鑻ヤ竴涓瓧絎︾殑浜岃繘鍒墮昏緫涓?x81涔嬪悗涓?鏃訛紝璇ュ瓧絎︿竴瀹氬皬浜?x81錛屾鏃惰瀛楃蹇呭畾涓嶆槸姹夊瓧錛屽弽涔嬶紝璇ュ瓧絎﹀簲璇ユ槸涓涓眽瀛楃殑棣栧瓧鑺傘?/p>

緇撳悎浠ヤ笂鍘熺悊灝變笉闅劇悊瑙d竴涓腑鑻辨枃娣峰悎瀛楃涓茬殑鎴彇鐨勫父鐢ㄤ唬鐮侊細

function gb_substr($str, $start, $len)
{
$s = '';
$j = 0;
for ($i=0; $i<strlen($str); $i++) {
   if (ord($str[$i]) & 0x81 != 0) { //鎴栬卭rd($str[$i]) > '0x80'
    $t = $str[$i].$str[$i+1];
    if (($i >= $start) && ($i+1 < $start+$len)) $s.= $t;
    $i++;
   } else {
    $t = $str[$i];
    if (($i >= $start) && ($i < $start+$len)) $s.= $t;
   }
   if ($i >= $start+$len) break;
}
return $s;
}



ivy-jie 2009-05-21 23:31 鍙戣〃璇勮
]]>
200813 浼犺緭瑙勫垝http://www.shnenglu.com/ivy-jie/articles/83440.htmlivy-jieivy-jieWed, 20 May 2009 01:34:00 GMThttp://www.shnenglu.com/ivy-jie/articles/83440.htmlhttp://www.shnenglu.com/ivy-jie/comments/83440.htmlhttp://www.shnenglu.com/ivy-jie/articles/83440.html#Feedback0http://www.shnenglu.com/ivy-jie/comments/commentRss/83440.htmlhttp://www.shnenglu.com/ivy-jie/services/trackbacks/83440.html闈㈠鑹板法澶嶆潅鐨勬妧鏈寫鎴橈紝鐧懼害鎵宕囧皻鐨勭郴緇熻璁″摬瀛︽槸“綆鍗曞彲渚濊禆”錛岃岀櫨搴︾殑宸ョ▼甯堜滑姝e湪浜掕仈緗戜笘鐣屼腑瀹炶返鐫榪欑鐞嗗康銆傝繖閲屾濂芥湁涓涓寫鎴橈紝璁╀綔涓虹櫨搴︿箣鏄熺殑浣犲皬璇曠墰鍒錛?br>鍦ㄥ鐞嗘暟浠ョ櫨浜胯鐨勭綉緇滀俊鎭殑榪囩▼涓紝鏈変竴涓緢甯歌鐨勯棶棰橈細鎬庝箞鏍峰皢涓涓泦緹や笂鐨勪俊鎭互鏈浣庣殑鎴愭湰浼犺緭鍒板彟澶栦竴涓泦緹や笂錛?br>• 鏁版嵁婧愰泦緹鏈塶鍙版湇鍔″櫒錛岀紪鍙蜂負1,2,…,n錛宨鍙鋒湇鍔″櫒涓婂緟浼犺緭鐨勬暟鎹噺涓篈i錛屽崟浣嶆槸GB銆?
• 鐩殑鍦伴泦緹鏈塵鍙版湇鍔″櫒錛岀紪鍙蜂負1,2,…,m錛宩鍙鋒湇鍔″櫒涓婄殑絀洪棽瀹歸噺涓築j錛屽崟浣嶄負GB銆?br>• A闆嗙兢鐨刬鍙鋒湇鍔″櫒涓婄殑姣廏B鏁版嵁瀵逛簬B鐨勯泦緹ょ殑j鍙鋒湇鍔″櫒鏀剁泭涓篤i,j錛屼粠A闆嗙兢鐨刬鍙鋒湇鍔″櫒鍚態闆嗙兢鐨刯鍙鋒湇鍔″櫒浼犺緭1GB鏁版嵁鐨勫紑閿涓篊i,j銆?br>浣犵殑浠誨姟鏄湪淇濊瘉A涓殑鎵鏈夋暟鎹紶杈撳畬姣曠殑鍓嶆彁涓嬶紝鎬т環姣擵/C灝介噺楂樸傚叾涓璙涓烘墍鏈夋暟鎹湪B闆嗙兢涓婄殑浠峰間箣鍜岋紝C涓烘誨紑閿銆傛崲鍙ヨ瘽璇達紝鑻闆嗙兢鐨刬鍙鋒湇鍔″櫒鍚態闆嗙兢鐨刯鍙鋒湇鍔″櫒鍙戦佷簡Ti,j涓狦B鐨勬暟鎹紝鍒欐т環姣斿畾涔変負錛?br>杈撳叆鏍煎紡
絎?琛屼袱涓暣鏁皀,m(1<=n,m<=50)錛屽嵆闆嗙兢A鍜孊鍚勮嚜鐨勬湇鍔″櫒鍙版暟銆?br>絎?琛屽寘鍚玭涓笉瓚呰繃100鐨勬鏁存暟A1,A2,…,An錛屽嵆闆嗙兢A涓瘡鍙版湇鍔″櫒鐨勫緟浼犺緭鏁版嵁閲忥紙鍗曚綅錛欸B錛夈?br>絎?琛屽寘鍚玬涓笉瓚呰繃100鐨勬鏁存暟B1,B2,…,Bm錛屽嵆闆嗙兢B涓瘡鍙版湇鍔″櫒鎵鑳芥帴鍙楃殑鏈澶ф暟鎹噺錛堝崟浣嶏細GB錛夈?br>絎?~n+3琛屾瘡琛屽寘鍚玬涓笉瓚呰繃100鐨勯潪璐熸暣鏁癡i,j錛岃〃紺洪泦緹鐨刬鍙鋒湇鍔″櫒涓瘡GB鏁版嵁瀵逛簬闆嗙兢B涓殑j鍙鋒湇鍔″櫒鐨勪環鍊箋?br>絎琻+4~2n+3琛屾瘡琛屽寘鍚玬涓笉瓚呰繃100鐨勬鏁存暟Ci,j錛岃〃紺洪泦緹鐨刬鍙鋒湇鍔″櫒涓瘡GB鏁版嵁浼犺緭鍒伴泦緹涓殑j鍙鋒湇鍔″櫒鎵闇瑕佺殑寮閿銆?br>杈撳嚭鏍煎紡
浠呬竴琛岋紝涓烘渶澶фт環姣斻傝緭鍑轟繚鐣欎笁浣嶅皬鏁幫紙鍥涜垗浜斿叆錛夈傚鏋淎鐨勬暟鎹棤娉曚紶杈撳畬姣曪紝杈撳嚭-1銆?br>鏍蜂緥杈撳叆
22
12
21
110
75
61
32
鏍蜂緥杈撳嚭
2.091
鏍蜂緥瑙i噴
涓涓柟妗堟槸錛?br>闆嗙兢A鐨?鍙鋒湇鍔″櫒鎶婃墍鏈夋暟鎹紶杈撳埌闆嗙兢B鐨?鍙鋒湇鍔″櫒錛屼環鍊?1錛屽紑閿6銆?br>闆嗙兢A鐨?鍙鋒湇鍔″櫒鎶?GB鏁版嵁浼犺緭鍒伴泦緹鐨?鍙鋒湇鍔″櫒錛屼環鍊?錛屽紑閿3錛岀劧鍚庢妸鍓╀笅鐨?GB鏁版嵁浼犺緭鍒伴泦緹鐨?鍙鋒湇鍔″櫒錛屼環鍊?錛屽紑閿2銆?br>鎬т環姣旓細(11+7+5)/(6+3+2)=2.091
鍙︿竴涓柟妗堟槸錛?br>闆嗙兢A鐨?鍙鋒湇鍔″櫒鎶婃墍鏈夋暟鎹紶杈撳埌闆嗙兢B鐨?鍙鋒湇鍔″櫒錛屼環鍊?錛屽紑閿1銆?br>闆嗙兢A鐨?鍙鋒湇鍔″櫒鎶婃墍鏈夋暟鎹紶杈撳埌闆嗙兢B鐨?鍙鋒湇鍔″櫒錛屼環鍊?4錛屽紑閿6銆?br>鎬т環姣旓細(0+14)/(1+6)=2銆?br>絎竴縐嶆柟妗堟洿浼樸?br>

ivy-jie 2009-05-20 09:34 鍙戣〃璇勮
]]>
200812 鍦嗗唴浜旇鏄?/title><link>http://www.shnenglu.com/ivy-jie/articles/83439.html</link><dc:creator>ivy-jie</dc:creator><author>ivy-jie</author><pubDate>Wed, 20 May 2009 01:22:00 GMT</pubDate><guid>http://www.shnenglu.com/ivy-jie/articles/83439.html</guid><wfw:comment>http://www.shnenglu.com/ivy-jie/comments/83439.html</wfw:comment><comments>http://www.shnenglu.com/ivy-jie/articles/83439.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ivy-jie/comments/commentRss/83439.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ivy-jie/services/trackbacks/83439.html</trackback:ping><description><![CDATA[<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><strong><span style="FONT-SIZE: 13.5pt; FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal">闂鑳屾櫙</span></strong><strong><span lang=EN-US style="FONT-SIZE: 13.5pt; FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt"><o:p></o:p></span></strong></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 12pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><font size=3><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">濡傚浘錛屼竴涓崐寰勪負</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">1</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">鐨勫渾鍛ㄤ笂鏈?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">5</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">涓偣銆傛寜瑙掑害鍒剁粰鍑?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">5</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">涓偣鐨勬瀬瑙?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">A<sub>i</sub> (0<=A<sub>i</sub><360, i=1..5)</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">銆傛寜涓嬪浘鐨勬柟娉曡繛鎴愪竴涓簲瑙掓槦</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">, </font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">璁$畻鍦嗚鍒囧壊鎴愮殑</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">11</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">涓儴鍒嗛潰縐殑鏂瑰樊銆?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></font></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: center; mso-pagination: widow-orphan" align=center><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font size=3><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><o:p></o:p></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><br></span><font size=3><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">鍏蜂綋鍦拌</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">, </font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">鍋囧畾</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">11</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">涓尯鍩熺殑闈㈢Н鍒嗗埆涓?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">S<sub>1</sub>,S<sub>2</sub>, ..., S<sub>11</sub></font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">錛岄偅涔堥潰縐殑鍧囧艱綆楁柟娉曚負錛?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></font></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: center; mso-pagination: widow-orphan" align=center><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font size=3><font face="Times New Roman">M = (S<sub>1</sub>+S<sub>2</sub>+...+S<sub>11</sub> ) / 11<o:p></o:p></font></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><br></span><font size=3><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">闈㈢Н鐨勬柟宸綆楁柟娉曚負錛?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></font></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: center; mso-pagination: widow-orphan" align=center><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font size=3><font face="Times New Roman">D = ((S<sub>1</sub>-M)<sup>2</sup> + (S<sub>2</sub>-M)<sup>2</sup> + ... + (S<sub>11</sub>-M)<sup>2</sup>) / 11<o:p></o:p></font></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3" align=left><strong><span style="FONT-SIZE: 13.5pt; FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal">杈撳叆鏍煎紡</span></strong><strong><span lang=EN-US style="FONT-SIZE: 13.5pt; FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt"><o:p></o:p></span></strong></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><font size=3><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">杈撳叆浠呬竴琛岋紝鍖呭惈</span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">5</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">涓?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">[0,359]</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">鍐呯殑浜掍笉鐩哥瓑鐨勬暣鏁般?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman"> <o:p></o:p></font></span></font></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3" align=left><strong><span style="FONT-SIZE: 13.5pt; FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal">杈撳嚭鏍煎紡</span></strong><strong><span lang=EN-US style="FONT-SIZE: 13.5pt; FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt"><o:p></o:p></span></strong></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><font size=3><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">杈撳嚭浠呬竴琛岋紝鍖呭惈涓涓疄鏁幫紝鍗沖悇閮ㄥ垎闈㈢Н鐨勬柟宸傝緭鍑轟繚鐣欏皬鏁扮偣鍚?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman">4</font></span><span style="FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal; mso-bidi-font-size: 10.5pt">浣嶃?/span><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman"> <o:p></o:p></font></span></font></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3" align=left><strong><span style="FONT-SIZE: 13.5pt; FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal">鏍蜂緥杈撳叆</span></strong><strong><span lang=EN-US style="FONT-SIZE: 13.5pt; FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt"><o:p></o:p></span></strong></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font size=3><font face="Times New Roman">0 144 72 288 216 <o:p></o:p></font></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3" align=left><strong><span style="FONT-SIZE: 13.5pt; FONT-FAMILY: 瀹嬩綋; mso-hansi-font-family: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-ascii-font-family: airal">鏍蜂緥杈撳嚭</span></strong><strong><span lang=EN-US style="FONT-SIZE: 13.5pt; FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt"><o:p></o:p></span></strong></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>0.0144</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3><strong>鎴戝闂鐨勫垎鏋?/strong>錛?/font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>1銆佹妸鏋佽鎺掑簭錛堟湁鍒╀簬鍚庣畫璁$畻錛夛紝杞寲涓虹洿瑙掑潗鏍囩郴鍧愭爣</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>2銆佹眰浜旇鏄熷唴浜ょ偣浜斾釜</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>3銆佹眰浜斾釜涓槦欏朵笁瑙掑艦闈㈢Н</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>4銆佹眰鍑?#8220;寮撳艦-涓夎褰?#8221;闈㈢Н錛岀劧鍚庝互浜斾釜灝忔墖褰負鏈煡閲忚В涓涓簲鍏冪嚎鎬ф柟紼嬬粍錛屾眰鍑轟簲涓皬鎵囧艦闈㈢Н</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>5銆佺敱鍦嗙殑闈㈢Н鍑忓幓姹傚嚭鐨勫崄涓潰縐紝寰楀埌閲嶅績鐨勪簲杈瑰艦闈㈢Н</font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>6銆佹牴鎹柟宸叕寮忔眰鍑虹瓟妗?/font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3>銆愯瘎浠楓戣繖涓柟娉曞熀鏈睘浜庢寜閮ㄥ氨鐝殑鏂規硶錛屽洜涓烘病鏈夊彂鎺樺埌鍦嗗唴鎺ヤ簲瑙掓槦鐨勭壒孌婃ц川錛屾墍浠ュ茍娌℃湁娑夊強鍒頒粈涔堟妧宸с?/font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3></font></span></p> <p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 17.55pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left><span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><font face="Times New Roman" size=3><strong>鎴戠殑浠g爜</strong></font></span></p> <span lang=EN-US style="FONT-FAMILY: airal; mso-bidi-font-family: 瀹嬩綋; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"> <pre class=xml name="code">#include <stdio.h><stdio.h></stdio.h> #include <stdlib.h><stdlib.h></stdlib.h> #include <math.h><math.h></math.h> #define PI 3.1415926535898 typedef struct POINT { double x; double y; }Point,*lpPoint;//鐐瑰潗鏍? struct COMB { POINT p; POINT PL;//宸︿氦鐐? POINT PR;//鍙充氦鐐? };//浜旂鐐圭殑闄勫甫緇撴瀯 COMB c[5];//緇撴瀯鏁扮粍 int arg[5];//瑙掑害 double areaG[5];//寮撳艦 double area[11];//11涓儴鍒嗛潰縐? //閫夋嫨鎺掑簭 void sort(int arr[], int n) { int i, j, min, t; for (i = 0; i < n -1; i++) { min = i; for (j = i + 1; j < n; j++) { if (arr[min] > arr[j]) { min = j; } } if (min != i) { t = arr[i]; arr[i] = arr[min]; arr[min] = t; } } } //涓ょ嚎孌典氦鐐? POINT GetCrossPoint(POINT p1, POINT p2, POINT q1, POINT q2) { /*鏍規嵁涓ょ偣寮忓寲涓烘爣鍑嗗紡錛岃繘鑰屾眰綰挎ф柟紼嬬粍*/ POINT crossPoint; double tempLeft,tempRight; //姹倄鍧愭爣 tempLeft = (q2.x - q1.x) * (p1.y - p2.y) - (p2.x - p1.x) * (q1.y - q2.y); tempRight = (p1.y - q1.y) * (p2.x - p1.x) * (q2.x - q1.x) + q1.x * (q2.y - q1.y) * (p2.x - p1.x) - p1.x * (p2.y - p1.y) * (q2.x - q1.x); crossPoint.x =tempRight /tempLeft; //姹倅鍧愭爣 tempLeft = (p1.x - p2.x) * (q2.y - q1.y) - (p2.y - p1.y) * (q1.x - q2.x); tempRight = p2.y * (p1.x - p2.x) * (q2.y - q1.y) + (q2.x- p2.x) * (q2.y - q1.y) * (p1.y - p2.y) - q2.y * (q1.x - q2.x) * (p2.y - p1.y); crossPoint.y =tempRight / tempLeft; return crossPoint; } //姹傛墍鏈変氦鐐? void cross() { int i; for (i=0;i<5;i++) { c[i].PL = GetCrossPoint(c[i].p,c[(i+3)%5].p,c[(i+1)%5].p,c[(i+4)%5].p); c[(i+4)%5].PR = c[i].PL; } } //void Helen(); //double SideLength(POINT X,POINT Y); //鐐瑰埌鐐圭殑璺濈 double SideLength( POINT X,POINT Y ) { double r=sqrt(((X.x-Y.x)*(X.x-Y.x)+(X.y-Y.y)*(X.y-Y.y))); return r; } //嫻蜂雞鍏紡姹備笁瑙掑艦闈㈢Н void Helen() { double a,b,d; //涓夎竟闀? double p; //騫沖潎鍊? for (int i=0; i<5; i++) { a=SideLength(c[i].p,c[i].PL); b=SideLength(c[i].PR,c[i].PL); d=SideLength(c[i].p,c[i].PR); p=0.5*(a+b+d); area[i]=sqrt((p*(p-a)*(p-b)*(p-d))); } } //姹備簲涓紦褰㈤潰縐? void Arch() { double x; double arc; double rui; for (int i=0;i<5;i++) { x=0.5*SideLength(c[(i+4)%5].p,c[(i+1)%5].p); rui = acos(x); arc=PI-2.0*acos(x); areaG[i]=0.5*arc-0.5*sin(arc); } } //瑙f柟紼嬫眰寮ц竟鐨勪簲鍧楀皬鎵囧艦闈㈢Н void Equation() { double temp[5]; //寮撳艦鍑忓幓涓夎(鏂圭▼鍙寵竟) for (int i=0; i<5; i++) { temp[i] = areaG[i] - area[i]; } //姹傝В area[5] = (temp[0]+temp[2]+temp[4]-temp[1]-temp[3])/2; area[6] = (temp[0]+temp[1]+temp[3]-temp[2]-temp[4])/2; area[7] = (temp[1]+temp[2]+temp[4]-temp[0]-temp[3])/2; area[8] = (temp[0]+temp[2]+temp[3]-temp[1]-temp[4])/2; area[9] = (temp[1]+temp[3]+temp[4]-temp[0]-temp[2])/2; } //姹傛渶鍚庝腑闂翠竴鍧楅潰縐? void LastArea() { double plus(0.0); for (int i=0;i<10;i++) { plus += area[i]; } area[10] = PI - plus; } int main(void) { int i; for (i=0;i<5;i++) { scanf("%d",&arg[i]); } sort(arg,5);//鎺掑簭 double d[5]; for (i=0;i<5;i++) { d[i] = (double)(arg[i])*PI/180.0; } //鐐瑰潗鏍? for (i=0;i<5;i++) { c[i].p.x = cos(d[i]); c[i].p.y = sin(d[i]); } //姹傛墍鏈変氦鐐? cross(); //----------姹傞潰縐?------------- Helen();//浜斾釜涓夎褰㈤潰縐? Arch();//寮撳艦闈㈢Н Equation();//瑙f柟紼嬫眰寮ц竟鐨勪簲鍧楀皬鎵囧艦闈㈢Н LastArea();//姹傛渶鍚庝腑闂翠竴鍧楅潰縐? //瀵筧rea[11]姹傛柟宸? double aver = PI/11.0; //printf("%.4f\n",aver); double result = 0.0;//鍔犲拰 for (i=0;i<11;i++) { result = result + (area[i]-aver)*(area[i]-aver); } result = result/11.0; result = (float)((int)(result*10000+0.5))/10000.0;//鍥涜垗浜斿叆鍙栧洓浣? printf("%.4f\n",result); return 0; }</pre> </span> <img src ="http://www.shnenglu.com/ivy-jie/aggbug/83439.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ivy-jie/" target="_blank">ivy-jie</a> 2009-05-20 09:22 <a href="http://www.shnenglu.com/ivy-jie/articles/83439.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣庨璇嶇殑榪囨護http://www.shnenglu.com/ivy-jie/articles/83426.htmlivy-jieivy-jieWed, 20 May 2009 00:46:00 GMThttp://www.shnenglu.com/ivy-jie/articles/83426.htmlhttp://www.shnenglu.com/ivy-jie/comments/83426.htmlhttp://www.shnenglu.com/ivy-jie/articles/83426.html#Feedback0http://www.shnenglu.com/ivy-jie/comments/commentRss/83426.htmlhttp://www.shnenglu.com/ivy-jie/services/trackbacks/83426.html  璇勫垎鏍囧噯錛? 
  紼嬪簭杈撳嚭緇撴灉蹇呴』姝g‘錛屽唴瀛樹嬌鐢ㄨ秺灝戣秺濂斤紝紼嬪簭鐨勬墽琛屾椂闂磋秺蹇秺濂?nbsp; 
#include<iostream>
#include<fstream>
#include<map>
#include<vector>
#include<string>
#include<cstring>
#include<cstdlib>
#include<iterator>
#include<algorithm>
#include<cctype>
using namespace std;

typedef map<string,int>::iterator mit;
typedef string::size_type sit;

int main()
{
map<string,int> words_count;
vector<string> sve;
string word;
string s=",!?.:""\n;'";
ifstream fin("E:\\corpus.txt");
if(!fin)
{
   cerr<<"unable to open file"<<endl;
   exit(0);
}
//璇誨彇騫剁粺璁″崟璇嶅崟璇?
while(fin>>word)
   {
    sit iter=word.find_first_of(s);
    if(iter!=string::npos)
      word=word.substr(0,iter-0); //澶勭悊鏍囩偣絎﹀彿
    string temp(strlwr(const_cast<char*>(word.c_str())));
    word=temp;
    sve.push_back(word);
    ++words_count[word];
   }
fin.close();
  
//鍒犻櫎涓暟鏈灝戠殑鍗曡瘝
mit i=words_count.begin();
int n=i->second;
for(;i!=words_count.end();++i)
   if(i->second<n) n=i->second;
for(mit i=words_count.begin();i!=words_count.end(); )
     {
      if(i->second==n)
      {
       sve.erase(remove(sve.begin(),sve.end(),i->first),sve.end());
       ++i;
      }
      else ++i;
     }
//杈撳嚭鍒板睆騫?br>copy(sve.begin(),sve.end(),ostream_iterator<string>(cout," "));
cout<<endl;
  
system("pause");
return 0;
}



ivy-jie 2009-05-20 08:46 鍙戣〃璇勮
]]>
瀛楃涓叉浛鎹?/title><link>http://www.shnenglu.com/ivy-jie/articles/83331.html</link><dc:creator>ivy-jie</dc:creator><author>ivy-jie</author><pubDate>Mon, 18 May 2009 16:19:00 GMT</pubDate><guid>http://www.shnenglu.com/ivy-jie/articles/83331.html</guid><wfw:comment>http://www.shnenglu.com/ivy-jie/comments/83331.html</wfw:comment><comments>http://www.shnenglu.com/ivy-jie/articles/83331.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ivy-jie/comments/commentRss/83331.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ivy-jie/services/trackbacks/83331.html</trackback:ping><description><![CDATA[<p><font size=2>瀛楃涓叉浛鎹?br></font><font size=2>棰樼洰鎻忚堪錛氳緙栧啓紼嬪簭錛屾牴鎹寚瀹氱殑瀵瑰簲鍏崇郴錛屾妸涓涓枃鏈腑鐨勫瓧絎︿覆鏇挎崲鎴愬彟澶栫殑瀛楃涓層?</font></p> <p><font size=2>杈撳叆鏁版嵁錛氱▼搴忚鍏ュ凡琚懡鍚嶄負text.txt鍜宒ict.txt鐨勪袱涓緭鍏ユ暟鎹枃鏈枃浠訛紝text.txt涓轟竴涓寘鍚ぇ閲忓瓧絎︿覆錛堝惈涓枃錛夌殑鏂囨湰錛屼互whitespace涓哄垎闅旂錛沝ict.txt涓鴻〃紺哄瓧絎︿覆錛坰1錛変笌瀛楃涓詫紙s2錛夌殑瀵瑰簲鍏崇郴鐨勫彟涓涓枃鏈紙鍚腑鏂囷級錛屽ぇ綰﹀湪1涓囪宸﹀彸錛屾瘡琛屼袱涓瓧絎︿覆錛堝嵆s1鍜宻2錛夛紝鐢ㄤ竴涓猏t鎴栫┖鏍煎垎闅斻俤ict.txt涓悇琛岀殑s1娌℃湁鎺掑簭錛屽茍鏈夊彲鑳芥湁閲嶅錛岃繖鏃朵互鏈鍚庡嚭鐜扮殑閭fs1鎵瀵瑰簲鐨剆2涓哄噯銆倀ext.txt鍜宒ict.txt涓殑姣忎釜瀛楃涓查兘鍙兘鍖呭惈闄hitespace涔嬪鐨勪換浣曞瓧絎︺倀ext.txt涓殑瀛楃涓插繀欏誨拰dict.txt涓殑鏌恠1瀹屽叏鍖歸厤鎵嶈兘琚浛鎹€傦紙涓轟究浜庤皟璇曪紝鎮ㄥ彲涓嬭澆嫻嬭瘯text.txt鍜宒ict.txt鏂囦歡錛屽疄闄呰繍琛屾椂鎴戜滑浼氫嬌鐢ㄤ笉鍚屽唴瀹圭殑杈撳叆鏂囦歡銆傦級</font></p> <p><font size=2>杈撳嚭鏁版嵁錛氬湪鏍囧噯杈撳嚭涓婃墦鍗皌ext.txt琚玠ict.txt鏇挎崲鍚庝簡鐨勬暣涓枃鏈?/font></p> <p><font size=2>璇勫垎鏍囧噯錛氱▼搴忚緭鍑虹粨鏋滃繀欏繪紜紝鍐呭瓨浣跨敤瓚婂皯瓚婂ソ錛岀▼搴忕殑鎵ц鏃墮棿瓚婂揩瓚婂ソ銆侾S錛?font size=3><span style="COLOR: red">c_str()榪斿洖涓涓畠鑷繁鐨勪嬌鐢ㄥ唴瀛樼殑鍦板潃錛堜竴涓狢-STYLE鐨剆tring鈥斺旓級</span>   <br>  浼氳嚜鍔ㄧ粰鏈鍚庢坊涓婁竴涓?\0'緇撴潫絎﹀彿   </font><br></font></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>#include<iostream></font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>#include<fstream></font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>#include<string></font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>#include<map></font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>using namespace std;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>map<string,string>dic;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>int main()</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>{</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>string s,a,b;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>char c;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>fstream file("dict.txt");</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>while (file>>a>>b)</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>dic[a]=b;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>file.close();</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span><span style="COLOR: red">freopen("text.txt","r",stdin);</span></font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>while (scanf("%c",&c)+1)</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>{</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>if (c&128)</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>{</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>s+=c;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>scanf("%c",&c);</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>}</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>if ((c&128)==0&&isspace(c))</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>{</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>if (!s.empty())</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                            </span>if (dic[s]!="")</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                                   </span>printf("%s",dic[s].c_str());</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                            </span>else</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                                   </span>printf("%s",s.c_str());</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>printf("%c",c);</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>s="";</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>}</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>else</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>s+=c;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>}</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>if (!s.empty())</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>if (dic[s]!="")</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>printf("%s",dic[s].c_str());</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>              </span>else</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>                     </span>printf("%s",s.c_str());</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2><span>       </span>return 0;</font></span></p> <p style="MARGIN: 0cm 0cm 0pt"><span><font size=2>}</font></span></p> <img src ="http://www.shnenglu.com/ivy-jie/aggbug/83331.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ivy-jie/" target="_blank">ivy-jie</a> 2009-05-19 00:19 <a href="http://www.shnenglu.com/ivy-jie/articles/83331.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.by2043.cn" target="_blank">MM131亚洲国产美女久久</a>| <a href="http://www.10jpka.cn" target="_blank">免费久久人人爽人人爽av</a>| <a href="http://www.xiguayo.cn" target="_blank">青草影院天堂男人久久</a>| <a href="http://www.abcvi.cn" target="_blank">精品国产一区二区三区久久蜜臀</a>| <a href="http://www.shipin168.cn" target="_blank">精品99久久aaa一级毛片</a>| <a href="http://www.x8587.cn" target="_blank">久久99国产精品久久99小说</a>| <a href="http://www.flznzb.cn" target="_blank">久久国产色AV免费看</a>| <a href="http://www.918gn.cn" target="_blank">久久国产精品波多野结衣AV</a>| <a href="http://www.bjxcst.cn" target="_blank">A级毛片无码久久精品免费</a>| <a href="http://www.glrsjk.cn" target="_blank">免费观看成人久久网免费观看</a>| <a href="http://www.slchurch.cn" target="_blank">无夜精品久久久久久</a>| <a href="http://www.p6817.cn" target="_blank">72种姿势欧美久久久久大黄蕉</a>| <a href="http://www.szdeyi.cn" target="_blank">少妇久久久久久被弄到高潮</a>| <a href="http://www.englishtutor.com.cn" target="_blank">色妞色综合久久夜夜</a>| <a href="http://www.g838.cn" target="_blank">亚洲国产成人久久精品99</a>| <a href="http://www.i9tao8.cn" target="_blank">国产精品对白刺激久久久</a>| <a href="http://www.5490.com.cn" target="_blank">热久久最新网站获取</a>| <a href="http://www.focuan.cn" target="_blank">热久久这里只有精品</a>| <a href="http://www.hanlexin.cn" target="_blank">亚洲va久久久噜噜噜久久狠狠 </a>| <a href="http://www.better-led.cn" target="_blank">激情综合色综合久久综合</a>| <a href="http://www.huanpou.cn" target="_blank">无码AV中文字幕久久专区</a>| <a href="http://www.japjoy.cn" target="_blank">国产无套内射久久久国产</a>| <a href="http://www.enepower.cn" target="_blank">久久久精品2019免费观看</a>| <a href="http://www.f7799.cn" target="_blank">大香伊人久久精品一区二区</a>| <a href="http://www.fpzhan.cn" target="_blank">国产精品青草久久久久福利99</a>| <a href="http://www.fzlqb.cn" target="_blank">97久久超碰国产精品2021</a>| <a href="http://www.i501.cn" target="_blank">一本一本久久a久久综合精品蜜桃</a>| <a href="http://www.cs556.cn" target="_blank">热综合一本伊人久久精品</a>| <a href="http://www.whruide.cn" target="_blank">国产精品伦理久久久久久</a>| <a href="http://www.510dpw.cn" target="_blank">四虎国产精品免费久久久</a>| <a href="http://www.jaqw.cn" target="_blank">久久综合狠狠综合久久</a>| <a href="http://www.ampul.cn" target="_blank">久久AV无码精品人妻糸列</a>| <a href="http://www.46test.cn" target="_blank">亚洲国产成人精品无码久久久久久综合</a>| <a href="http://www.tengfangwang.cn" target="_blank">99国产欧美精品久久久蜜芽</a>| <a href="http://www.liushishipin.cn" target="_blank">伊人久久大香线蕉av不卡</a>| <a href="http://www.bjhswt.com.cn" target="_blank">国产欧美久久久精品影院</a>| <a href="http://www.mfuq.cn" target="_blank">久久久午夜精品福利内容</a>| <a href="http://www.squc.cn" target="_blank">亚洲国产精品无码久久青草</a>| <a href="http://www.zmcgmih22.cn" target="_blank">亚洲国产精品综合久久一线</a>| <a href="http://www.bushenba.cn" target="_blank">蜜臀久久99精品久久久久久</a>| <a href="http://www.alexa178.cn" target="_blank">青春久久</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>