现在位置: 首页 > retry发表的所有文章
题意:输出top n高频出现的词和对应词出现的次数。注意一点,可能出现超出n个输出的情况,当且仅当超出部分的单词出现次数和 第n个相同。 思路:模拟。 // file name: LA6578.cpp // // author: kereo // // create time: 2014年10月15日 星期三 23时11分51秒 // //***********************************// #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<set> #include<map> #include<vector> #include<stack> #include<cmath> #inclu......
阅读全文
  • 04月
  • 06日
综合 ⁄ 共 327字 评论关闭
大意略。 思路:推数据。 #include <iostream> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <stack> #include <algorithm> using namespace std; int main() { int times = 0; int n; while(scanf("%d", &n) && n >= 0) { int t = 1, ans = 0; while(t < n) { t *= 2; ans++; } printf("Case %d: %d\n", ++times, ans); } return 0; }
阅读全文
  • 10月
  • 19日
综合 ⁄ 共 1517字 评论关闭
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. class Solution { public: string intToRoman(int num) { char symbol[] = {'I', 'V', 'X', 'L', 'C', 'D', 'M'}; int i = 6; int weight = 1000; string result; while (num) { const int digit = num / weight; if (digit <= 3) { result.append(digit, symbol[i]); } ......
阅读全文
  • 08月
  • 20日
综合 ⁄ 共 8694字 评论关闭
//初始化textfield并设置位置及大小   UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 130, 30)];   //设置边框样式,只有设置了才会显示边框样式     text.borderStyle = UITextBorderStyleRoundedRect;   typedef enum {     UITextBorderStyleNone,      UITextBorderStyleLine,     UITextBorderStyleBezel,     UITextBorderStyleRoundedRect     } UITextBorderStyle;    //设置输入框的背景颜色,此时设置为白色 如果使用了自定义的背景图片边框会被忽略掉      text.backgrou......
阅读全文
  • 05月
  • 01日
综合 ⁄ 共 765字 评论关闭
      题意:  给出A和B,一有限小数的A进制数转换成B进制数也是有限小数的判定。       我觉得如果进制转换做的好点的话,这种题应该不难。       解法:一个小数的A 进制可以表示为:1/(A^1)+1/(A^2)+1/(A^3).....转换成B进制就是不断的乘B直到为0;(1/(A^1)+1/(A^2)+1/(A^3).....)*B^m,进一步化简,要是结果为有限小数,则B^m/(A^n)必须整除,所以A中的质因子在B中都要出现。 #include <iostream> #include <cstring> #include <cstdio> using namespace std; long long num[1000009]; long long ......
阅读全文
  • 04月
  • 27日
综合 ⁄ 共 1326字 评论关闭
<style name="FullScreenDialog" parent="android:style/Theme.Dialog"> <item name="android:backgroundDimAmount">0.8</item> <item name="android:backgroundDimEnabled">true</item> <item name="android:windowFrame">@null</item> <item name="android:windowFullscreen">true</item> <item name="android:windowNoTitle">true</item> <item name="android:background">@android:color/transparent</item> <......
阅读全文
  • 04月
  • 24日
综合 ⁄ 共 1854字 评论关闭
容斥原理是对集合的运算。 举个例子三个集合的容斥原理: A ∪ B ∪ C   =   A +  B + C   -  A ∩ B   -   B ∩ C   -   C ∩ A   + A ∩ B ∩ C. 多个集合的容斥原理: hdu 1796  How many integers can you find Problem Description   Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-integer set is {2,3}, so there is another set {2,3,4,6,8,9,10}, all the integers o......
阅读全文
  • 04月
  • 17日
综合 ⁄ 共 8065字 评论关闭
  一、进程(process) 1.默认情况下,每个application都运行在一个独立的process中,所有的component都运行在该process中的主线程中(main线程,由于主要处理UI,所以也叫UI线程)2.可以在manifest文件中通过component的android:process属性为当前组件指定运行的process,甚至不同application中的组件都可以运行在同一个process中,  但大多数应用,我们不应该这样去配置,除非你确实想让你的某些组件在单独的process中被管理3.android系统会在资源不足的情况下kill掉某些他认为可以kill的process在为用户正在执行的动作提供资源,......
阅读全文
原文链接:http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html OpenGL has been around a long time, and from reading all the accumulated layers of documentation out there on the Internet, it's not always clear what parts are historic and what parts are still useful and supported on modern graphics hardware. It's about time for a new OpenGL introduction that walks through the parts that are still relevant today. Update: Join the Reddit discussi......
阅读全文
  • 02月
  • 13日
综合 ⁄ 共 1188字 评论关闭
1.获得请求路径的URL,例如URL为: http://127.0.0.1:8080/struts2/test/path1/path2/path3/test.action 2.首先寻找namespace为/path1/path2/path3的package, 如果存在这个package,则在这个package中寻找名字为test的Action, 若找到了该Action,则访问该Action, 若没有找到该Action则立即转向默认表空间[namespase=""]去寻找该Action 若在默认表空间中找到了该Action,则执行该Action 若在默认表空间中没有找到该Action,则执行该表空间中定义的默认action 若默认表空间中定义......
阅读全文
  • 02月
  • 06日
综合 ⁄ 共 15415字 评论关闭
delphi Midas SQLServer的自增字段的处理 1.新增时,表中有自增字段,但是不希望用Refresh,直接ApplyUpdates直接看见自增字段的值在DataSetProvider.AfterUpdateRecord写如下代码 DataSetProvider.Options.poPropogateChanges:=True; procedure TForm1.DataSetProvider1AfterUpdateRecord(Sender: TObject;   SourceDS: TDataSet; DeltaDS: TCustomClientDataSet;   UpdateKind: TUpdateKind); begin//DstId TADODataset //FId 为自增字段  if   UpdateKind=ukInsert then   begin   DstId.CommandText:='select  @@Identity as F......
阅读全文
  • 01月
  • 29日
综合 ⁄ 共 385字 评论关闭
在android里面使用自定义字体 Typeface lcdFont = Typeface.createFromAsset(getAssets(), "fonts/lcd2mono.ttf"); txtMineCount.setTypeface(lcdFont); txtTimer.setTypeface(lcdFont); 在assets底下新建目录fonts,然后将字体文件拷进即可 txtMineCount和txtTimer都是textview型的控件   在视图的onsizechanged里获取视图宽度,一般情况下默认宽度是320,所以计算一个缩放比率rate = (float) w/320   (w是实际宽度) 然后在设置字体尺寸时 paint.setTextSize((int)(8*rate));   (8是在分辨率宽为320 下需要设置的字......
阅读全文